How to find the second largest salary in the emp database and
also How to find 3rd,4th and so on ........ in the emp database

plz mail the answer @ mak2786@gmail.com

Answer Posted / bobby

select p.emp_id,p.name,p.salary from
( select emp_id,name,salary,dense_rank()over( order by
salary desc)rank
from empTable )p
where rank=2

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does a specific recovery model need to be used for a replicated database? : sql server replication

529


What is the importance of a recovery model?

605


What is the difference function and stored procedure?

562


What do you understand by a view? What does the with check option clause for a view do?

601


Why use identity in sql server?

558






What are the character string functions supported by sql server 2005?

516


What are out-of-range errors with date and time literals?

551


can a table be moved to different filegroup? : Sql server administration

544


You want to implement the one-to-one relationship while designing tables. How would you do it?

527


How to display a past time in days, hours and minutes?

570


How to set the current database in ms sql server?

522


What is database isolation in sql server? : sql server database administration

564


What is partitioned view?

523


What is the maximum rows in sql server table?

508


Difference between Inner vs outer joins?

531