find out the second highest salary?

Answer Posted / abhijit ramakant parb

select min(a.sal) from(select distinct d.sal from emp d
order by sal desc) a where rownum<=2;

To retrieve all columns

select * from emp where sal=(select min(a.sal) from(select
distinct d.sal from emp d order by sal desc) a where
rownum<=2);

Is This Answer Correct ?    12 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to code performance tuning of oracle PL/SQL? can any body send me the perfect answer?

4670


How to update a table row with a record?

597


What is the difference between truncate & delete command?

619


How translate command is different from replace?

550


What is the fastest query method to fetch data from the table?

866






What view(s) do you use to associate a users SQLPLUS session with his o/s process?

1910


What does sharding mean?

539


What happens to indexes if you drop a table?

701


How to find the duplicate rows count from employees table in oracle?

554


What is MTTR advisor in Oracle?

610


Does facebook use oracle?

579


How to best split csv strings in oracle 9i?

590


How to connect to a local oracle 10g xe server?

537


when we are importing items in inventory, showing errors, Oracle support suggested us for running scripts & also suggested if we run scripts, iprocurement applicaation if is there it will show shared and if we go in future for iprocurement, it wont work. So kinldy suggest any functional solution.

1477


How do I call oracle stored procedures that take no parameters?

568