728x90
< 문제 >
[SQL50] 570. Managers with at Least 5 Direct Reports (JOIN)
< 풀이 >
WITH direct AS(
SELECT managerId, SUM(1) AS manage_cnt
FROM Employee
WHERE managerId IS NOT NULL
GROUP BY managerId)
SELECT A.name
FROM Employee A LEFT JOIN direct B ON A.id = B.managerID
WHERE B.manage_cnt >= 5;
728x90
'coding_test > SQL 문제' 카테고리의 다른 글
[LeetCode] 620. Not Boring Movies (AGGREGATE) (0) | 2025.02.10 |
---|---|
[LeetCode] 1934. Confirmation Rate (JOIN) (0) | 2025.02.08 |
[LeetCode] 1280. Students and Examinations (JOIN) (0) | 2025.02.08 |
[LeetCode] 577. Employee Bonus (JOIN) (0) | 2025.02.08 |
[LeetCode] 1661. Average Time of Process per Machine (JOIN) (0) | 2025.02.08 |