'Medium question of SQL level Second Highest Salary
//"This question asks in leet code" //Second Highest Salary
select max(salary) SecondHighestSalary
from Employee
where salary NOT IN (select max(salary) from Employee)
Solution 1:[1]
you can use row_number() over ( order by salary) and then use rownum=2 for second heighest sal.
select salary SecondHighestSalary from
(
select row_number() over ( order by salary desc) rn, salary
from Employee) subq
where rn=2
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Koushik Roy |
