How to get second highest salary from a table

Answer Posted / srinivas

select * from emp m where(select count(distinct sal)+1 from emp s where s.sal>m.sal)=2

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is flag in sql?

739


What is cost in sql execution plan?

683


When is the explicit cursor used ?

764


What is the use of count (*) in sql?

754


How do you select unique values in sql?

706






How does sql store data?

663


What are the string functions in sql?

720


How long will it take to learn pl sql?

689


What is a heap in sql?

718


What is exception? What are the types of exceptions?

789


what are the 'mysql' command line options? : Sql dba

741


What is nosql vs sql?

869


What is the difference between the conventional and direct path loads? : aql loader

905


What is data abstraction in sql?

722


how can we transpose a table using sql (changing rows to column or vice-versa) ? : Sql dba

690