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

Explain about the command-line tool SQLCMD?

0 Answers  


how to get the maximum among two tables,for example table 1 (dep1) have (emp_id,emp_name,salary) columns and table 2 (dept2) have (emp_id,emp_name,salary) columns,i want which employee have the maximum salary among two tables?

9 Answers   Deloitte, Lason,


What is candidate key with example?

0 Answers  


Tell me what is use of except clause? How it differs from not in clause?

0 Answers  


What is trigger and different types of Triggers?

0 Answers   QuestPond,






How to change the data type of an existing column with "alter table" statements in ms sql server?

0 Answers  


What are the risks of storing a hibernate-managed object in a cache? How do you overcome the problems?

0 Answers  


What's the purpose of Stored Procedure?

6 Answers   Wipro,


difference between Clustered index and non clustered index ?

0 Answers   Infosys,


How to delete a login name in ms sql server?

0 Answers  


What are the types of normalization?

0 Answers  


what’s the difference between Covering Indexes and Clustered Indexes ? how to use clustered index small ?

0 Answers  


Categories