[문제]
[MySQL]
WITH highest_salary AS (
SELECT *
, MAX(salary) OVER (PARTITION BY departmentId ORDER BY salary DESC) AS highest_salary
FROM Employee
)
SELECT d.name AS Department
, hs.name AS Employee
, hs.salary AS Salary
FROM highest_salary AS hs
LEFT JOIN Department AS d ON hs.departmentId = D.id
WHERE hs.salary = hs.highest_salary
'SQL > LeetCode' 카테고리의 다른 글
| [LeetCode] 196. Delete Duplicate Emails (0) | 2025.02.17 |
|---|---|
| [LeetCode] 185. Department Top Three Salaries (0) | 2025.02.17 |
| [LeetCode] 183. Customers Who Never Order (0) | 2025.02.17 |
| [LeetCode] 182. Duplicate Emails (0) | 2025.02.17 |
| [LeetCode] 181. Employees Earning More Than Their Managers (0) | 2025.02.17 |
