write the query for find the top 2 highest salary in sql
server

Answers were Sorted based on User's Feedback



write the query for find the top 2 highest salary in sql server..

Answer / krishna

select * from emp e where 2>(select count(esal) from emp
where e.esal<=esal)

Is This Answer Correct ?    3 Yes 7 No

write the query for find the top 2 highest salary in sql server..

Answer / uday

select * from Emp e where 1=(select count(Distinct
d.esal)from emp d where d.esal>e.esal)

i am sure that it should work.


Any thing wrong plz inform me

Is This Answer Correct ?    5 Yes 9 No

write the query for find the top 2 highest salary in sql server..

Answer / k.elumalai

select max(salary)from emp where salary <(select sum(salary)
from emp)

Is This Answer Correct ?    6 Yes 12 No

write the query for find the top 2 highest salary in sql server..

Answer / krishna

select * from emp e where 2>=(select count(distinct esal)
from emp where e.esal<=esal)

Is This Answer Correct ?    8 Yes 16 No

write the query for find the top 2 highest salary in sql server..

Answer / santhosh kumar

select Distinct Top 2 Salary from EMP order by Salary desc

Is This Answer Correct ?    7 Yes 15 No

write the query for find the top 2 highest salary in sql server..

Answer / sivashankar.soma

select ename,sal from emp E where 1=(select count(*) from
emp where E.sal<sal)

Is This Answer Correct ?    16 Yes 29 No

Post New Answer

More SQL Server Interview Questions

What is the difference between coalesce() & isnull()?

0 Answers  


How you can minimize the deadlock situation?

0 Answers  


What is function of CUBE ?

0 Answers   HCL,


what is the difference between delete table and truncate table commands? : Sql server database administration

0 Answers  


what is integrated security (SSPI). why we use in the connection string?

2 Answers  






Well sometimes sp_reanmedb may not work you know because if some one is using the db it will not accept this command so what do you think you can do in such cases?

2 Answers  


How to link tables in sql server?

0 Answers  


How do we return a record set from a Stored Procedure in SQl server 2000?

3 Answers  


What is the full form of ddl?

0 Answers  


What are the advantages of policy management?

0 Answers  


Tell me what is the significance of null value and why should we avoid permitting null values?

0 Answers  


What is master database? : SQL Server Architecture

0 Answers  


Categories