Skip to content

Commit d2a4152

Browse files
committed
이예진: [SQL] Department Top Three Salaries_241210
1 parent 7c0c57d commit d2a4152

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
SELECT
2+
d.name Department, er.name Employee, salary
3+
FROM (
4+
SELECT
5+
departmentId, name, salary,
6+
DENSE_RANK() OVER(PARTITION BY departmentId ORDER BY salary DESC) 'rank'
7+
FROM Employee
8+
GROUP BY departmentId, name, salary
9+
ORDER BY departmentId
10+
) er
11+
INNER JOIN Department d
12+
ON er.departmentId = d.id
13+
WHERE er.rank <= 3;

0 commit comments

Comments
 (0)