문제
입력 코드
1.
SELECT (
SELECT DISTINCT Salary
FROM Employee
ORDER BY salary DESC
LIMIT 1
OFFSET 1) AS SecondHighestSalary
2.
SELECT DISTINCT MAX(salary) AS SecondHighestSalary
FROM Employee
WHERE salary < (SELECT MAX(salary)
FROM Employee)
코드 설명
#SELECT #DISTINCT #ORDER BY #DESC #LIMIT #OFFSET #MAX
문제 출처
'SQL' 카테고리의 다른 글
#123. [LeetCode / MySQL] 1327. List the Products Ordered in a Period (0) | 2024.06.23 |
---|---|
#122. [LeetCode / MySQL] 1484. Group Sold Products By The Date (0) | 2024.06.22 |
#120. [LeetCode / MySQL] 196. Delete Duplicate Emails (0) | 2024.06.21 |
#119. [LeetCode / MySQL] 1527. Patients With a Condition (0) | 2024.06.21 |
#118. [LeetCode / MySQL] 1667. Fix Names in a Table (0) | 2024.06.20 |