문제
입력 코드
SELECT
e2.employee_id, e2.name,
COUNT(*) AS reports_count,
ROUND(AVG(e1.age)) AS average_age
FROM Employees AS e1
INNER JOIN Employees AS e2
ON e1.reports_to = e2.employee_id
GROUP BY e2.employee_id, e2.name
ORDER BY e2.employee_id
코드 설명
#SELECT #COUNT #ROUND #AVG #INNER JOIN #GROUP BY #ORDER BY
문제 출처
'SQL' 카테고리의 다른 글
#106. [LeetCode / MySQL] 610. Triangle Judgement (0) | 2023.10.02 |
---|---|
#105. [LeetCode / MySQL] 1789. Primary Department for Each Employee (0) | 2023.10.01 |
#103. [LeetCode / MySQL] 1045. Customers Who Bought All Products (0) | 2023.09.29 |
#101. [LeetCode / MySQL] 1729. Find Followers Count (0) | 2023.09.27 |
#100. [LeetCode / MySQL] 596. Classes More Than 5 Students (0) | 2023.09.26 |