how to find nth highest salary

Answer Posted / dewashish kumar pal

select salary from tablename t where (n-1)= (select count(*) from tablename where salary > t.salary);


note:- t = tablename

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of triggers are there?

571


Can a stored procedure call itself or recursive stored procedure? How many levels sp nesting is possible?

522


what's the difference between delete table and truncate table commands? : Sql server database administration

484


What command would you use to add a column to a table in sql server?

748


How to use copy and concatenate commands in SQL?

601






What is a join in sql? What are the types of joins?

523


Explain the different types of backups available in sql server? : sql server database administration

517


What are the differences between web role and worker role?

100


as a general practice, it is recommended to have dbo be the owner of all database objects however, in your database you find number of tables owned by a user other than dbo, how could you fix this? : Sql server administration

537


How do I create a stored procedure in sql server?

520


How do I make a resultset scrollable?

507


What are logical database components? : SQL Server Architecture

482


What are the main differences between #temp tables and @table variables and which one is preferred?

553


Suppose you want to implement the one-to-many relationships while designing tables. How would you do it?

503


How many types of built in functions are there in sql server 2012?

490