how to find nth highest salary
Answer Posted / eldho k scaria
There are two methods:(Suppose table name is EMPLOYEE,
Colomn name is SALARY, and N=6)
SELECT * FROM EMPLOYEE
WHERE SALARY IN
(SELECT TO 1 SALARY (SELECT DISTINCT TOP 6 SALARY FROM
EMPLOYEE ORDER BY SALARY DESC)
A ORDER BY SALARY)
or
SELECT * FROM EMPLOYEE E1
WHERE (6-1)=(SELECT COUNT (DISTINCT (E2.SALARY))
FROM EMPLOYEE E2
WHERE E2.SALARY>E1.SALARY)
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Where do you find the default Index fill factor and how to change it?
How many types of schemas are there?
How to find the login name linked to a given user name?
What stored by the msdb? : sql server database administration
in the physical file layout, where should the transaction log be stored in relation to the data file? : Sql server administration
How will you add a dimension to cube? : sql server analysis services, ssas
what are the steps you will take to improve performance of a poor performing query? : Sql server database administration
How will you know when statistics on a table are obsolete?
What is logon trigger?
What are the different Authentication modes in SQL Server and how can you change authentication mode?
System variable and temporary variables
Explain index in sql server?
Explain microsoft sql server functions?
1.what is the diff between nolock optimizer and read uncommitted isolation? 2.what is the diff between revoke and deny? 3.what is percieved down time? 4.whether password protection are required for backups?if yes why?if no why? 5.what is fill factor? 6.what is cost analysis? 7.what is mean by piece meal restore? 8.what is 'rowguidcol'? 9.impersonate permission? 10.what is selectivity?
Can you always create a cache of a report?