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 purpose of forms?

0 Answers  


how can u select the Distinct values in the table, table having 20 columns , i want all columns

2 Answers  


What is the difference between a local and a global variable?

5 Answers  


Explain multiserver query

0 Answers  


what is an extended stored procedure? Can you instantiate a com object by using t-sql? : Sql server database administration

0 Answers  






How to test odbc dsn connection settings?

0 Answers  


What is the maximum size of column in sql server?

0 Answers  


Explain the ways to controlling cursor behavior?

0 Answers  


What is 2nf normalization?

0 Answers  


what is meant by deafult in sql server?

2 Answers  


What are the two types of concurrency?

4 Answers  


What is log shipping?

0 Answers  


Categories