Coding Test

Leetcode - 184. Department Highest Salary

Indo Yoon

문제

Loading...
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

정답

SELECT Department.name AS Department, Employee.name as Employee, salary as Salary
FROM Employee
JOIN Department ON Employee.departmentId = Department.id
WHERE (salary, departmentId) in (
    SELECT MAX(salary), departmentId FROM Employee GROUP BY departmentId
)