how to find the second highest salary from emp table?

Answer Posted / vijay kintali

select e1.ename,e1.sal from emp e1 where n=(select count
(distinct e2.sal) from emp e2 where e1.sal<=e2.sal);

Note:n here is nth highest salary.......

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is left join and outer join same?

536


What is sql*plus?

563


how do you control the max size of a heap table? : Sql dba

530


Is microsoft sql free?

592


How do you select unique values in sql?

494






Explain scalar functions in sql?

575


What is pl sql architecture?

496


What is user defined functions?

570


What is procedure and function in sql?

524


What is rowtype?

559


how to create a new table in mysql? : Sql dba

544


explain normalization concept? : Sql dba

582


What are %type and %rowtype for?

611


Why do we create stored procedures & functions in pl/sql and how are they different?

498


Is there a 64 bit version of ssms?

509