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 command used to recompile the stored procedure at run time?

0 Answers  


Distinguish between nested subquery and correlated subquery?

0 Answers  


Which are new data types introduced in sql server 2008?

0 Answers  


any one can explain Self mapping Delegation Remote Credentials

1 Answers  


What is mapping schema?

0 Answers  






How are the unique and primary key constraints different?

0 Answers  


What is 5nf in normalization form?

0 Answers  


What are triggers in ms sql server?

0 Answers  


What is the difference between for auto and for nested?

0 Answers  


can you any body tell me why are go for the rebuild the master database.what is the reason?

2 Answers  


Why do you want to join software field as you have done your BE in Electronics?

0 Answers   Cap Gemini, HCL,


What the different components in replication and what is their use?

0 Answers  


Categories