how to find nth highest salary
Answer Posted / amit
select * from emp as e1 where sal (n-1) = select distinct
(count(*) from emp as e2 where e2.sal>e1.sal)
Where n is no that u want which postion's salary u want
suppose second higest means n=2
Amit
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What triggers long term care?
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?
How to delete a login name in ms sql server?
Can we call future method from queueable?
What are the elements of dbms?
Explain forward - only cursors?
How to change the data type of an existing column with "alter table" statements in ms sql server?
How many replicas are maintained for each sql azure db?
What is Lock table in SQL?
How would we use distinct statement? What is its use?
What are the advantages of sql stored procedure?
Where is localdb stored?
What will be query used to get the list of triggers in a database?
What is cursors?
What are the recovery models for a database?