# nth highest salary in sql snippet in sql

## nth highest salary

user6007

SELECT salary FROM Employee ORDER BY salary DESC LIMIT N-1, 1

## 3rd highest salary in sql

user2657

Here is the solution for 3rd 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 = 3;

## find nth highest salary in sql

user7647

SELECT * FROM Employee WHERE sal =
(
SELECT MIN(sal) FROM Employee
WHERE  sal IN (
SELECT DISTINCT TOP N
sal FROM Employee
ORDER BY sal DESC
)
)

## n highest salary in sql

user8904

SELECT TOP 1 salary
FROM (
SELECT DISTINCT TOP N salary
FROM #Employee
ORDER BY salary DESC
) AS temp
ORDER BY salary

## nth highest salary in sql

user6750

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;

## first max salary in sql

user8262

SELECT first-name
FROM employees
WHERE salary = (SELECT MAX(salary) FROM employees);