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

Write the SQL query to drop, truncate and delete table.

548


What is normalization according to you and explain its different levels?

522


What is unpivot?

567


What are system databases into sql server (2005/2008)?

580


What are the differences between INNER JOIN, LEFT JOIN and RIGHT JOIN in SQL Server?

610






What is the difference between SQL notification and SQL invalidation?

585


Define self join?

625


What are indexers?

623


Explain about system stored procedure?

590


What is the purpose of the tempdb database?

571


What are the types of dml?

554


What is 2nf normalization?

535


What types of replication are supported in sql server?

560


Explain active/passive and active/active cluster configurations?

623


how to trace the traffic hitting a sql server? : Sql server database administration

1121