Snoopy [리트코드/SQL] 14. Second Highest Salary (176)
코딩테스트/리트코드 SQL

[리트코드/SQL] 14. Second Highest Salary (176)

Sooyoon Jeong 2022. 12. 16.

목차

 

🤔 문제 분석

1) Write an SQL query to report the second highest salary from the Employee table. If there is no second highest salary, the query should report null.

 

💡 풀이

SELECT MAX(salary) AS SecondHighestSalary
FROM Employee
WHERE Salary <> (SELECT MAX(salary) FROM Employee)

 

✍️ check point!

서브쿼리

 

댓글