𝙎𝙌𝙇

[HackerRank] Top Competitors

콜라맛갈비 2023. 7. 10. 15:21
728x90

https://www.hackerrank.com/challenges/full-score/problem?isFullScreen=true 

 

Top Competitors | HackerRank

Query a list of top-scoring hackers.

www.hackerrank.com

 

 

만점을 맞은 challenge_id 개수가 2개 이상인 것들을

challenge_id 개수 내림차순, hacker_id 오름차순으로 정렬하기!

 

select s.hacker_id
    , h.name
from submissions s 
    left join challenges c on s.challenge_id = c.challenge_id
    left join difficulty d on c.difficulty_level = d.difficulty_level
    left join hackers h on s.hacker_id = h.hacker_id
where s.score = d.score
group by s.hacker_id
    , h.name
having count(s.challenge_id) > 1
order by count(s.challenge_id) desc
	, s.hacker_id
728x90