How to Find Nth Highest Salary in SQL

 SELECT * FROM(

SELECT emp_name, salary, DENSE_RANK() 

over(ORDER BY salary DESC) AS ranking FROM employee) AS k

WHERE ranking=2;



SELECT * FROM(

SELECT emp_name, salary, ROW_NUMBER() 

over(ORDER BY salary DESC) AS ranking FROM employee) AS k

WHERE ranking=2;



SELECT * FROM(

SELECT emp_name, salary, RANK() 

over(ORDER BY salary DESC) AS ranking FROM employee) AS k

WHERE ranking=2;