SQL/MySQL 문제풀이

[LeetCode] Rank Scores (윈도우함수 풀이)

혜린티나 2022. 6. 23. 15:19

[문제]

 

rank scores 문제 바로 가기 

 

Rank Scores - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

 

[풀이]

mssql 윈도우함수 이용해서 풀이 

SELECT score
     , DENSE_RANK() OVER (ORDER BY score DESC) rank
FROM scores
ORDER BY score DESC