File tree 3 files changed +8
-1
lines changed
database/DepartmentHighestSalary 3 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -335,4 +335,5 @@ All solutions will be accepted!
335
335
| 626| [ Exchange Seats] ( https://leetcode-cn.com/problems/exchange-seats/description/ ) | [ mysql] ( ./database/ExchangeSeats ) | Medium|
336
336
| 178| [ Rank Scores] ( https://leetcode-cn.com/problems/rank-scores/description/ ) | [ mysql] ( ./database/RankScore ) | Medium|
337
337
| 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|
Original file line number Diff line number Diff line change
1
+ # Department Highest Salary
2
+ We can solve this problem by MAX FUNCTION and sub-query
Original file line number Diff line number Diff line change
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 )
You can’t perform that action at this time.
0 commit comments