SQL/Hacker Rank
[MEDIUM] Top Competitors
소금깨
2022. 10. 26. 04:01
Top Competitors | HackerRank
Query a list of top-scoring hackers.
www.hackerrank.com
문제 조건
2개 이상의 챌린지에서 만점을 받은 참가자의 이름과 id를 출력하시오
만점을 받은 챌린지의 개수를 기준으로 내림차순 -> id 오름차순
문제 풀이
select h.hacker_id,
h.name
from submissions s
inner join hackers h on s.hacker_id = h.hacker_id
inner join challenges c on s.challenge_id = c.challenge_id
inner join difficulty d on c.difficulty_level = d.difficulty_level
where s.score = d.score
group by h.hacker_id, h.name
having count(*) > 1
order by count(*) desc, h.hacker_id