how to find nth highest salary

Answer Posted / bharath

select distinct(sal) from emp a where 3 = (select
count(distinct(sal)) from emp b where a.sal<= b.sal)

replace 3 by 2 for second highest...

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are wait types?

588


What is partition index in sql server?

608


Can binary strings be converted into numeric or float data types?

555


What stored by the model?

552


Explain primary key in sql server?

569






What is set nocount on?

502


Explain DBCC?

570


What is candidate key with example?

516


What command do we use to rename a database?

615


What are the types of processing and explain each? : sql server analysis services, ssas

738


What’s the distinction between dropping a info and taking a info offline?

598


What programming language would you use to create embedded functions in ssrs?

122


What is the significance of null value and why should we avoid permitting null values?

532


How do I open a .db file?

482


What is abstracting periodical?

529