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

Answers were Sorted based on User's Feedback



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

Answer / sridhar

select gross_pay from tbl_payroll where gross_pay != (select
max(gross_pay) from tbl_payroll) limit 0,3

Is This Answer Correct ?    0 Yes 8 No

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

Answer / rajeev

select salary-1 from users where salary in (select
max(salary) from users);

Is This Answer Correct ?    0 Yes 8 No

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

Answer / ashish kumar

To find nth maximum salry

Select salary from tbl_name a where
n-1=(Select count(distinct(count(*))) from tbl_name b
where b.salary>a.salary)

Is This Answer Correct ?    10 Yes 20 No

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

Answer / suhail

select top 1 salary from (select top 5 salary from
emp_table order by salary desc)temptable order by salary asc

Is This Answer Correct ?    17 Yes 36 No

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

Answer / gunjan sapra

select top 10 from tbl_name order by salary desc

Is This Answer Correct ?    4 Yes 39 No

Post New Answer

More SQL Server Interview Questions

what is replication? where do u use Go Keyword?

1 Answers   Satyam,


How to turn on the mssql api module in php?

0 Answers  


Give an example of why you would want to denormalize a database

0 Answers  


what is the difference between Delete and Truncate command in SQL

0 Answers   BirlaSoft,


What are dml (data manipulation language) statements in ms sql server?

0 Answers  






Explain what is the use of custom fields in report?

0 Answers  


Do you know what is similarity and difference between truncate and delete in sql?

0 Answers  


What is full outer join in sql server joins?

0 Answers  


Why use stored procedures in sql server?

0 Answers  


When setting replication, is it possible to have a publisher as 64 bit sql server and distributor or subscribers as a 32 bit sql server?

0 Answers  


what is a join and explain different types of joins? : Sql server database administration

0 Answers  


Suppose you want to implement the one-to-many relationships while designing tables. How would you do it?

0 Answers  


Categories