how to find the second highest salary from emp table?

Answer Posted / aravind naidu

select * from emp e where (select count(*) from emp where sal>=e.sal)=&n; put n = 2 for second highest sal,n = 3 for third highest sal ....and so on.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is cursor and its types?

555


What is the usage of nvl function?

594


What does the base_object_type column shows in the user.triggers data dictionary view?

569


What are sql injection vulnerabilities?

497


Why do we need a foreign key?

546






Who developed sql?

567


what is the difference between cluster and non cluster index? : Sql dba

550


How do you delete data from a table?

537


how to get @@error and @@rowcount at the same time? : Sql dba

525


What is a crud api?

495


Why should I use postgresql?

561


How to select random rows from a table?

518


What do you know by pl/sql cursors?

563


how many groups of data types? : Sql dba

564


Do we need to create index on primary key?

463