Managers with at Least 5 Direct Reports - LeetCode
Can you solve this real interview question? Managers with at Least 5 Direct Reports - Table: Employee +-------------+---------+ | Column Name | Type | +-------------+---------+ | id | int | | name | varchar | | department | varchar | | managerId | int | +-
leetcode.com
1
2
3
4
5
6
7
|
# Write your MySQL query statement below
SELECT e1.name
FROM Employee e1
JOIN Employee e2
ON e1.id = e2.managerId
GROUP BY e1.name
HAVING COUNT(*) >= 5
|
cs |
반응형
'SQL' 카테고리의 다른 글
leetcode 1517. Find Users With Valid E-Mails (0) | 2023.06.07 |
---|---|
leetcode 1633. Percentage of Users Attended a Contest (0) | 2023.06.01 |
leetcode 570. Managers with at Least 5 Direct Reports (0) | 2023.05.31 |
leetcode 584. Find Customer Referee (0) | 2023.05.29 |
leetcode 1757. Recyclable and Low Fat Products (0) | 2023.05.29 |
댓글