Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Inventory Optimization
- MS SQL Server
- 피그마인디언
- leetcode
- ProfileReport
- 파이썬
- 프로그래머스
- eda
- ABC Analysis
- ModelCheckPoint
- pandas profiling
- forecast
- 코딩테스트
- kaggle
- SKU Consolidation
- 데이터분석
- 딥러닝
- SQL
- TensorFlowGPU
- 코딩테스트연습
- Product Demand
- MySQL
- Labor Management System
- 웨어하우스 보관 최적화
- 신경쓰기의 기술
- 당신의 인생이 왜 힘들지 않아야 한다고 생각하십니까
- Gaimification
- tensorflow
- HackerRank
- oracle
Archives
- Today
- Total
오늘도 배운다
184. Department Highest Salary / LeetCode, SQL, MySQL 본문
코딩테스트연습(SQL)
184. Department Highest Salary / LeetCode, SQL, MySQL
LearnerToRunner 2023. 3. 5. 10:19문제
source: LeetCode
Write an SQL query to find employees who have the highest salary in each of the departments.
Return the result table in any order.
The query result format is in the following example.
제출답안(MySQL)
WITH max_sal_by_dpt AS (
SELECT
departmentid,
MAX(salary) AS salary
FROM employee
GROUP BY departmentid
)
SELECT
d.name AS Department,
e.name AS Employee,
salary AS Salary
FROM
employee AS e
JOIN department AS d
ON e.departmentid = d.id
WHERE (departmentid, salary) IN (SELECT departmentid, salary FROM max_sal_by_dpt)
문제 바로가기(MySQL)
728x90
'코딩테스트연습(SQL)' 카테고리의 다른 글
626. Exchange Seats / LeetCode, SQL, MySQL (0) | 2023.03.10 |
---|---|
1158. Market Analysis I / LeetCode, SQL, MySQL (0) | 2023.03.06 |
177. Nth Highest Salary / LeetCode, SQL, MySQL (0) | 2023.03.05 |
180. Consecutive Numbers / LeetCode, SQL, MySQL (0) | 2023.03.04 |
178. Rank Scores / LeetCode, SQL, MySQL (0) | 2023.03.04 |
Comments