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
Explain “@@rowcount” and “@@error” in sql server?
What are key constraints?
How to insert new line characters into strings?
Can you leave a union at any time?
How to download and install microsoft .net framework version 2.0?
Does dbcc checkdb requires db to be in single_user mode? : sql server database administration
Do you know what is xpath?
What is not null constraint?
Suggest a method of joining two tables.
What are some examples of schemas?
What are the differences between INNER JOIN, LEFT JOIN and RIGHT JOIN in SQL Server?
Please explain go command in sql server?
What is the command used to check locks in microsoft sql server?
Why I am getting this error when renaming a database in ms sql server?
What is isolation levels?