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 steps to follow to configure SQL*Net?
What is change data capture (cdc) feature?
Why we need to use secondry database file? though, we can do same work using primary database file also.
Do you know how to store and query spatial data?
Explain what is dbcc?
what is sql server? : Sql server database administration
What is default constraint in ms sql server?
Using the customer, and order table in northwind database, please write a query to produce xml?
What are sql server functions?
What is precedence constraint?
How does using a separate hard drive for several database objects improves performance right away?
Do you know exporting and importing utility?
Explain different types of collation sensitivity?
What type of Index will get created after executing the above statement?
What are the advantages of passing name-value pairs as parameters?