일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- delete join
- BOT
- MySQL
- Pseudo Lab
- 2023년 목표
- 빅데이터를 지탱하는 기술
- Data Engineering
- hackerrank
- 알고리즘
- dsf
- 그리디
- airflow webserver
- Dynamic Programming
- docker image
- docker
- airflow architecture
- datacamp
- 백준 온라인 저지
- 데이터 엔지니어
- Airflow
- 백준온라인저지
- leetcode
- Spark
- docker container
- SQL
- data_engineer
- terraform
- 프로그래머스
- Python
- telegram
Archives
- Today
- Total
Lim Seunghyun Space
[Leetcode] 184. Department Highest Salary 본문
문제 출처
Department Highest Salary - LeetCode
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.com
나의 풀이(MySQL)
select dep.name as Department, emp.name as Employee, emp.salary as Salary
from
-- part별 최대 급여를 받는 사람을 조회
(select e.name, e.salary, e.departmentId
from
-- part별 최대 급여 게산
(select departmentId, max(salary) as max_salary
from Employee as e
group by departmentId) as ds
join Employee as e on ds.departmentId = e.departmentId
where e.salary = ds.max_salary) as emp
join Department as dep on emp.departmentId = dep.id
728x90
'SQL > SQL 문제' 카테고리의 다른 글
[Leetcode] 197. Rising Temperature (0) | 2022.04.18 |
---|---|
[Leetcode] 196. Delete Duplicate Emails (0) | 2022.04.18 |
[Leetcode] 183. Customers Who Never Order (0) | 2022.03.23 |
[Leetcode] 182. Duplicate Emails (0) | 2022.03.23 |
[Leetcode] 181. Employees Earning More Than Their Managers (0) | 2022.03.23 |