find the third highest salary?

Answer Posted / meher

SELECT SAL FROM EMP A WHERE &N= (SELECT COUNT(DISTINCT) SAL
FROM EMP B WHERE A.SAL<B.SAL)

--Pass the value for N as 2 to get 3rd highest salary.
--pass 0 for highest sal,1 for 2nd highest,2 for 3rd
highest and so on....

Is This Answer Correct ?    6 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is transaction? : Sql dba

738


What are the events on which a database trigger can be based?

834


Is sql low level language?

767


what is normalization? : Sql dba

747


Can we use join in subquery?

786


Can we call stored procedure in function?

719


What is an exception in pl/sql?

740


What is materialized view. What are different methods of refresh?

1081


How to read xml file in oracle pl sql?

697


What is minus?

767


Is sql better than access?

735


What is a record in a database?

791


how to calculate the difference between two dates? : Sql dba

740


What is 19 null in sql?

714


When sql appeared?

823