Leetcode

LeetCode 178. Rank Scores [MySql]

치킨먹고싶어요 2022. 6. 3. 17:01

https://leetcode.com/problems/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

 

코드: 

select score,DENSE_RANK() OVER (ORDER BY Score DESC) AS 'Rank'
from Scores
order by score DESC
cs

풀이: 

스코어를 역순으로 출력하며 DENSE_RANK() OVER()를 이용하여 요구하는 중복처리를 해 줍니다.