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 do you understand by recursive stored procedures?
explain different types of constraints? : Sql server database administration
Is it important for a database administrator to understand the operating system and file access?
What the class forname () does?
What do you understand by physical_only option in dbcc checkdb?
What is the use of stored procedure?
What is blocking?
Can group functions be used in the order by clause in ms sql server?
Explain what is meant by replication of database?
Do you know what is a trace frag? Where do we use it?
How many primary keys are possible in a table?
What are the steps to take to improve performance of a poor performing query? : sql server database administration
What are the new features introduced in SQL Server 2000 (or the latest release of SQL Server at the time of your interview)? What changed between the previous version of SQL Server and the current version?
List out the difference between union and union all in sql server?
What options are there to delete rows on the publisher and not on the subscriber? : sql server replication