leetcode:
My Code:
SELECT Score,
(SELECT count(DISTINCT score) FROM Scores AS b WHERE a.score<b.score)+1 AS Rank
FROM Scores AS a
ORDER BY rank;
# 這邊的 a.score < b.score 會用全部b table 去一個一個比較a table的一個欄位
# 有點像
# for(i=0;i<6;i++)
# for(j=0;j<6;j++)
# if(a[i]<b[j]) 的概念