8000 solve problem Department Highest Salary · P-ppc/leetcode@0d90db3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d90db3

Browse files
committed
solve problem Department Highest Salary
1 parent 2058084 commit 0d90db3

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,4 +335,5 @@ All solutions will be accepted!
335335
|626|[Exchange Seats](https://leetcode-cn.com/problems/exchange-seats/description/)|[mysql](./database/ExchangeSeats)|Medium|
336336
|178|[Rank Scores](https://leetcode-cn.com/problems/rank-scores/description/)|[mysql](./database/RankScore)|Medium|
337337
|180|[Consecutive Numbers](https://leetcode-cn.com/problems/consecutive-numbers/description/)|[mysql](./database/ConsecutiveNumbers)|Medium|
338-
|177|[Nth Highest Salary](https://leetcode-cn.com/problems/nth-highest-salary/description/)|[mysql](./database/NthHighestSalary)|Medium|
338+
|177|[Nth Highest Salary](https://leetcode-cn.com/problems/nth-highest-salary/description/)|[mysql](./database/NthHighestSalary)|Medium|
339+
|184|[Department Highest Salary](https://leetcode-cn.com/problems/department-highest-salary/description/)|[mysql](./database/DepartmentHighestSalary)|Medium|
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Department Highest Salary
2+
We can solve this problem by MAX FUNCTION and sub-query
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Write your MySQL query statement below
2+
select d.Name as Department, e.Name as Employee, Salary
3+
from Employee as e, Department as d
4+
where e.DepartmentId = d.Id and Salary = (select max(Salary) from Employee where DepartmentId = d.Id)

0 commit comments

Comments
 (0)
0