find out the second highest salary?

Answer Posted / hari kanth

select sal from(select sal,rank() over(order by sal desc)
rnk from emp) e
where e.rnk=2;
(OR)
select rownum,sal from emp group by sal,rownum
having rownum=2;
(OR)
select rn,sal from( select rownum rn,sal from emp group by
sal,rownum order by sal desc)
where rn=2;

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

20. Using a set operator, display the client number of all clients who have never placed an order.

1797


How to start instance with a minimal initialization parameter file?

535


What is backup in Oracle?

569


How to rebuild an index in oracle?

552


What is key preserved table?

562






Explain the use of rows option in imp command.

604


What is execute immediate in oracle?

549


What is primefaces used for?

559


How to delete multiple rows from a table in oracle?

563


What are the different types of modules in oracle forms?

562


How do we get field detail of a table?

627


What privilege is needed for a user to delete rows from tables in another schema?

562


How are extents allocated to a segment?

575


What is user managed backup in Oracle?

612


How do I learn what codesets are available in oracle?

575