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 / pankaj arya

select top 1 sal from emp where empid in(select top 2 empid
from emp order by sal desc) order by
sal asc

if you want to get 3rd one than put 'top 3' in subquery and
same for 4th, 5th....

Is This Answer Correct ?    15 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

why would you use sql agent? : Sql server database administration

497


What is resultset concur_updatable?

555


How would you add a section to a table?

547


Can a trigger be created on a view?

547


How does using a separate hard drive for several database objects improves performance right away?

503






What is the meaning of resultset type_scroll_insensitive?

540


Define inner join? Explain with an example?

489


Why is sql server log file full?

508


What are the tables in sql?

592


What is the cartesian product of the table?

525


What is identity?

527


What does man by sql wildcard characters in sql server?

497


How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?

559


What are the differences between stored procedure and view in sql server?

602


What are the five major components of a dbms?

493