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 / aditya kumar bisoi

SELECT EmpId,Salary
FROM(SELECT ROW_NUMBER() OVER(ORDER BY Salary Desc) AS [ROW_NUMBER],* FROM (SELECT DISTINCT Salary,Empid FROM EMPDetails)Emp)Emp1
WHERE ROW_NUMBER BETWEEN 2 AND 5

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Find columns used in stored procedure?

520


What is sql service broker?

586


Explain what is the difference between union and union all?

545


What is schemabinding a view?

520


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

570






What is the report builder?

106


What is the difference between clustered index and primary key?

500


What are the essential components of sql server service broker?

560


How to set database to be read_only in ms sql server?

548


How to stop log file growing too big?

571


How to modify an existing user defined function?

590


What is primary key and example?

502


What does ss stand for sexually?

578


What are the different index configurations a table can have?

508


What happens if you are trying to access a schema not owned by you?

508