how to find nth highest salary
Answer Posted / vinay upadhyay
These are tested queries to find Nth highest salary
Select distinct(sal) From employee emp Where n =
( Select Count(Distinct y.sal) From employee y Where y.sal
>=emp.sal)
OR
select distinct(salary) from employee order by salary desc
limit n-1,1
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the differences between char and varchar in ms sql server?
what are defaults? : Sql server database administration
What is logon trigger?
How to encrypt Strored Procedure in SQL SERVER?
How to execute a sql statement using odbc_exec()?
Can we store videos inside the sql server table?
What is the name of the system variable that returns the number of rows affected by a SQL statement?
What is the significance of master, tempdb and model databases?
Explain different types of BACKUPs avaialabe in SQL Server? Given a particular scenario, how would you go about choosing a backup plan?
How do triggers work?
What are the characteristics of modern DBMS?
How to Insert multiple rows with a single insert statement?
Can sql servers linked to other servers?
We need to perform what steps in the following order to work with a cursor?
Difference between Sql server reporting services and Crystal reports?