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

Explain the truncate command? : SQL Server Architecture

775


Can you type more than one query in the query editor screen at the same time?

772


Explain what is sql server english query?

725


What is shared lock?

647


How do you create a clustered index?

710






What is the report model project?

122


Describe the functionalities that views support.

846


What part does database design plays a role in performance of an sql server-based application?

718


How to loop through result set objects using mssql_fetch_array()?

751


Tell me what is fill factor?

714


what exactly sql injuction.how to overcome.....

2243


IF more than one Site is accessing the same Database server and I want to move the DB with Minimum down time? How will you do

1555


What causes index fragmentation?

746


What is the optimization being performed in oracle and SQL Server?

797


Can we call future method from queueable?

755