Published on

Leetcode - 184. Department Highest Salary

Authors
  • avatar
    Name
    Indo Yoon
    Twitter
Table of Contents

문제

[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.

LeetCode

](https://leetcode.com/problems/department-highest-salary/)

정답

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
)