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
- early stopping
- leetcode
- 클라우드컴퓨팅
- Git
- HTML
- hackerrank
- 버전충돌
- 교차 엔트로피
- coding
- 깃헙협업
- L1정규화
- L2정규화
- 코딩공부
- 선형 모형
- RLIKE
- AWS
- PYTHON
- elastic net
- mysql
- CSS
- github
- sql
- window function
- branch
- 편향-분산 교환
- programmers
- conflict
- 온라인협업
- merge
- full request
Archives
- Today
- Total
Im between cherry
LeetCode | MySQL | 185. Department Top Three Salaries 본문
leetcode.com/problems/department-top-three-salaries/
/* RANK(), DENSE_RANK() */
SELECT t.Employee,
t.Department,
t.Salary
FROM(
SELECT department.name AS department
, employee.name AS employee
, employee.salary AS salary
, DENSE_RANK() OVER (PARTITION BY departmentid ORDER BY salary DESC) AS dr
FROM employee
INNER JOIN department ON employee.DepartmentId = department.id
)t
WHERE t.dr <= 3
'데이터분석 > practice_query' 카테고리의 다른 글
LeetCode | MySQL | 177. Nth Highest Salary (0) | 2020.09.09 |
---|---|
LeetCode | MySQL | 184. Department Highest Salary (0) | 2020.09.08 |
LeetCode | MySQL | 180. Consecutive Numbers (0) | 2020.09.08 |
LeetCode | MySQL | 177. Nth Highest Salary (0) | 2020.09.03 |
Programmers | MySQL | DATETIME에서 DATE로 형 변환 (0) | 2020.09.02 |
Comments