Top Competitors

  • + 1 comment

    way too many joins, if I was asked this in an interview, I am screwed. Takes forever to understand the question.

    SELECT s.hacker_id, h.name FROM ( Difficulty AS d LEFT JOIN Challenges as c ON d.difficulty_level = c.difficulty_level LEFT JOIN Submissions AS s ON s.challenge_id = c.challenge_id LEFT JOIN Hackers AS h ON h.hacker_id = s.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;