Skip to content

Commit 07a4821

Browse files
committed
solve problem Rank Score
1 parent e1e4783 commit 07a4821

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
@@ -332,4 +332,5 @@ All solutions will be accepted!
332332
|197|[Rising Temperature](https://leetcode-cn.com/problems/rising-temperature/description/)|[mysql](./database/RisingTemperature)|Easy|
333333
|181|[Employees Earning More Than Their Managers](https://leetcode-cn.com/problems/employees-earning-more-than-their-managers/description/)|[mysql](./database/EmployeesEarningMoreThanTheirManagers)|Easy|
334334
|176|[Second Highest Salary](https://leetcode-cn.com/problems/second-highest-salary/description/)|[mysql](./database/SecondHighestSalary)|Easy|
335-
|626|[Exchange Seats](https://leetcode-cn.com/problems/exchange-seats/description/)|[mysql](./database/ExchangeSeats)|Medium|
335+
|626|[Exchange Seats](https://leetcode-cn.com/problems/exchange-seats/description/)|[mysql](./database/ExchangeSeats)|Medium|
336+
|178|[Rank Scores](https://leetcode-cn.com/problems/rank-scores/description/)|[mysql](./database/RankScore)|Medium|

database/RankScore/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Rank Score
2+
We can solve this problem by sub-query

database/RankScore/solution.sql

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 s.Score,
3+
(select count(distinct Score) from Scores where Score >= s.Score) as Rank
4+
from Scores as s order by Score desc

0 commit comments

Comments
 (0)