Medium: Question 4

 avatar
user_0571526250
mysql
3 years ago
537 B
4
Indexable
/*Medium: Question 4 */
SELECT hacker.hacker_id , hacker.name
FROM submissions submission
JOIN hackers hacker on hacker.hacker_id = submission.hacker_id
JOIN challenges challenge on challenge.challenge_id = submission.challenge_id
JOIN difficulty difficulty on difficulty.difficulty_level = challenge.difficulty_level

WHERE submission.score = difficulty.score
AND challenge.difficulty_level = difficulty.difficulty_level          
GROUP BY hacker.hacker_id, hacker.name
HAVING COUNT(*) > 1
ORDER BY COUNT(*) DESC, hacker.hacker_id ASC;
Editor is loading...