write the query for find the top 2 highest salary in sql
server
Answers were Sorted based on User's Feedback
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 |
select max(salary)from emp where salary <(select sum(salary)
from emp)
| Is This Answer Correct ? | 6 Yes | 12 No |
Answer / santhosh kumar
select Distinct Top 2 Salary from EMP order by Salary desc
| Is This Answer Correct ? | 7 Yes | 15 No |
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 |
Can we take the full database backup in log shipping?
What is the difference between the 2 operating modes of database mirroring?
how to find nth highest salary
103 Answers Cognizant, IBM, NexGen, Oracle,
Tell me what is log shipping?
When do you use SQL Profiler?
What is a ddl statement?
What is referential integrity? What are the advantages of it?
4 Answers Descon, Digital Domain,
What is normalization in Database ?
what is the difference between count(*) and count(1) ?
What is meant by referential integrity?
What is the use of MOVE keyword in restore command
What is “begin trans”, “commit tran”, “rollback tran” and “savetran”?
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)