rank_scores.sql
MariaDB 11.4
Not run yet
+ 5 hidden
Input
scores id points 1 85 2 92 3 78 4 92 5 85 6 60
Expected
[{"points": 92, "score_rank": 1}, {"points": 92, "score_rank": 1}, {"points": 85, "score_rank": 2}, {"points": 85, "score_rank": 2}, {"points": 78, "score_rank": 3}, {"points": 60, "score_rank": 4}]Both 92s share first place. 85 is the next distinct score, so it is ranked 2, not 3, and 78 and 60 follow as 3 and 4.