문제
입력 코드
1. SUBQUERY
SELECT employee_id FROM Employees
WHERE salary < 30000
AND manager_id NOT IN (SELECT employee_id FROM Employees)
ORDER BY employee_id;
2. LEFT JOIN
SELECT e1.employee_id FROM Employees AS e1
LEFT JOIN Employees AS e2
ON e1.manager_id = e2.employee_id
WHERE e1.salary < 30000
AND e2.employee_id IS NULL
AND e1.manager_id IS NOT NULL
ORDER BY employee_id;
코드 설명
#SELECT #WHERE #NOT IN #ORDER BY #LEFT JOIN # JOIN #NULL #AS #ON
문제 출처
'SQL' 카테고리의 다른 글
#113. [LeetCode / MySQL] 1341. Movie Rating (0) | 2024.06.18 |
---|---|
#112. [LeetCode / MySQL] 626. Exchange Seats (0) | 2024.06.17 |
#110. [LeetCode / MySQL] 1907. Count Salary Categories (0) | 2023.10.06 |
#109. [LeetCode / MySQL] 1204. Last Person to Fit in the Bus (0) | 2023.10.05 |
#108. [LeetCode / MySQL] 1164. Product Price at a Given Date (0) | 2023.10.04 |