how to find nth highest salary

Answer Posted / sudhir

DISPLAY THE RECORDS WHO'S GETTING 3RD HIGHEST SALARY.

SELECT * FROM EMP E1
WHERE 3 =(SELECT COUNT(DISTINCT(SAL))
FROM EMP E2
WHERE E1.SAL <= E2.SAL)

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the properties of subqueries in sql server?

627


Explain Normalization and DE normalization

689


What is the maximum rows in sql server table?

599


What is SQL Azure Federations?

106


What specific conditions database should meet, before you can bulk copy data into it using bcp?

638






Can we perform backup restore operation on tempdb?

660


How do we know if any query is retrieving a large amount of data or very little data?

635


What is a join in sql? What are the types of joins?

606


What are the tools available in market as an alternative to sql server reporting services?

98


You are doing log shipping due to some reasons it is failing. How you will proceed from there

1628


How the authentication mode can be changed?

735


What is the recommended total size of your memory optimized tables?

622


Is truncate a dml command?

606


What is in place upgrade in sql server?

607


What is use of except clause? How it differs from not in clause?

689