Top Competitors

Jimin·2022년 8월 26일
0

HackerRank

목록 보기
15/27

Julia just finished conducting a coding contest, and she needs your help assembling the leaderboard! Write a query to print the respective hacker_id and name of hackers who achieved full scores for more than one challenge. Order your output in descending order by the total number of challenges in which the hacker earned a full score. If more than one hacker received full scores in same number of challenges, then sort them by ascending hacker_id.


SELECT H.hacker_id, H.name
FROM Hackers H, Difficulty D, Challenges C, Submissions S
WHERE 
H.hacker_id = S.hacker_id
AND D.difficulty_level = C.difficulty_level
AND S.challenge_id = C.challenge_id
AND D.score = S.score
GROUP BY H.hacker_id, H.name
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC, H.hacker_id;
profile
https://github.com/Dingadung

0개의 댓글