https://leetcode.com/problems/second-highest-salary/
Second Highest Salary - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
1. Problem

2. Analysis
1. 2번째로 높은 salary를 구해야 하기 때문에 where절에 서브쿼리를 이용해서 구했다.
3. Solution
<sql />
SELECT MAX(Salary) AS SecondHighestSalary
FROM Employee
WHERE Salary < (SELECT MAX(Salary) FROM Employee);
'Algorithm > SQL' 카테고리의 다른 글
[SQL][Leetcode] 181. Employees Earning More Than Their Managers (0) | 2020.06.21 |
---|---|
[SQL][Leetcode] 177. Nth Highest Salary (0) | 2020.06.19 |
[SQL][Leetcode] 175. Combine Two Tables (0) | 2020.06.19 |
[SQL][프로그래머스] 보호소에서 중성화한 동물 (0) | 2020.06.17 |
[SQL][프로그래머스] 오랜 기간 보호한 동물(2) (0) | 2020.06.16 |