Q4_Medium

 avatar
user_9923638973
mysql
2 years ago
391 B
1
Indexable
Never
SELECT H.hacker_id, H.name
FROM submissions S 
    JOIN challenges C 
        ON S.challenge_id = C.challenge_id 
    JOIN difficulty D 
        ON C.difficulty_level = D.difficulty_level 
    JOIN hackers H 
        ON S.hacker_id = H.hacker_id AND S.score = D.score 
GROUP BY H.hacker_id, H.name 
HAVING COUNT(S.hacker_id) > 1 
ORDER BY COUNT(S.hacker_id) DESC, 
          S.hacker_id ASC;