Database SQL Query for N th highest salary

//Change the N-value to get the salary[For example if we need 2 nd highest salary use 
//[N-1]=[2-1]


SELECT * 
FROM Employee Emp1
WHERE (N-1) = ( 
SELECT COUNT(DISTINCT(Emp2.Salary))
FROM Employee Emp2
WHERE Emp2.Salary > Emp1.Salary);

Comments