Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9e9b8e3

Browse files
committed
백제완: [SQL] Department Top Three Salaries_241210
1 parent 934ea24 commit 9e9b8e3

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
SELECT
2+
B.name `Department`
3+
, A.name `Employee`
4+
, A.salary `Salary`
5+
FROM
6+
Employee A
7+
INNER JOIN Department B
8+
ON A.departmentId = B.id
9+
WHERE
10+
(
11+
SELECT COUNT(DISTINCT salary)
12+
FROM Employee C
13+
WHERE departmentId = A.departmentId AND salary >= A.salary
14+
) <= 3
15+
ORDER BY
16+
Department
17+
, Salary DESC

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /