how to find nth highest salary

Answer Posted / rahul tripathi

The Genral answer which can work on any SQL:-

select salary from emp e1 where (n-1)=(select count(*)
from emp where salary > e1.salary )

Rahul Tripathi

rahultripathi@inkanpur.com

Is This Answer Correct ?    249 Yes 76 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain important index characteristics?

560


Can we use max in where clause?

517


What are the parts of a function?

523


What is difference between commit and rollback when used in transactions?

500


What are the risks of storing a hibernate-managed object in a cache? How do you overcome the problems?

596






What is a trace frag?

644


in the physical file layout, where should the transaction log be stored in relation to the data file? : Sql server administration

552


What is fill factor and pad index?

542


I have triggers,views,functions,stored Procedures for a table. When I am dropping that table which objects are deleted?

601


How you can get a list of all the table constraints in a database?

517


What are the different types of sub-queries?

600


What is indexing a document?

555


What is command parameter in ssrs?

120


Are connections to sql server encrypted?

576


Which is better statement or preparedstatement?

526