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 |
Tags
- MySQL
- ProfileReport
- oracle
- pandas profiling
- 프로그래머스
- 웨어하우스 보관 최적화
- SQL
- eda
- MS SQL Server
- 피그마인디언
- Inventory Optimization
- kaggle
- ABC Analysis
- 신경쓰기의 기술
- leetcode
- 파이썬
- TensorFlowGPU
- Product Demand
- tensorflow
- 데이터분석
- 코딩테스트연습
- 당신의 인생이 왜 힘들지 않아야 한다고 생각하십니까
- HackerRank
- Gaimification
- SKU Consolidation
- forecast
- 코딩테스트
- ModelCheckPoint
- 딥러닝
- Labor Management System
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