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
Answer Posted / s n yagneswara babu
TO FIND THE SECOND HIGHEST SAL IN EMP TABLE
select max(sal) from emp where sal not in(select max(sal)
from emp)
TO FIND THE 3RD HIGHEST SAL IN EMP TABLE
select max(sal) from emp where sal not in(select distinct
top 2 sal from emp order by sal desc)
TO FIND THE Nth HIGHEST SAL IN EMP TABLE
select max(sal) from emp where sal not in(select distinct
top N-1 sal from emp order by sal desc)
yagneswara babu
yagnesh_sn@yahoo.co.in
| Is This Answer Correct ? | 39 Yes | 7 No |
Post New Answer View All Answers
What are the types of lock supported by ?
What is the difference between update lock and exclusive lock?
How to include date and time values in sql statements?
What is ddl and dml commands?
What is not null constraint?
what is blocking? : Sql server database administration
How to execute a sql statement using mssql_query()?
when you create a database how is it stored? : Sql server database administration
What is lock escalation? : sql server database administration
What are the lambda triggers?
What is check constraint in sql server?
What do you understand by mirroring?
How to use “drop” keyword in sql server and give an example?
What is pessimistic concurrency?
Why use “pivot” in sql server?