how to get nth highest salary in sql code example
Example 1: nth highest salary in sql
Here is the solution for nth highest
salary from employees table
SELECT FIRST_NAME , SALARY FROM
(SELECT FIRST_NAME, SALARY, DENSE_RANK() OVER
(ORDER BY SALARY DESC) AS SALARY_RANK
FROM EMPLOYEES)
WHERE SALARY_RANK = n;
Example 2: 3rd height salary sql
SELECT MIN(EmpSalary) from (
SELECT EmpSalary from Employee ORDER BY EmpSalary DESC LIMIT 3
);