We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
SELECT tt.hacker_id, tt.name FROM
(
SELECT t.hacker_id, t.name, COUNT(hacker_id) AS times_max FROM
(
SELECT h.name AS name, c.challenge_id AS challenge_id, c.difficulty_level AS difficulty_level, d.score AS max_score, s.hacker_id AS hacker_id, s.score AS user_score
FROM challenges AS c JOIN difficulty AS d
ON d.difficulty_level = c.difficulty_level
JOIN submissions AS s ON c.challenge_id = s.challenge_id
JOIN hackers AS h ON h.hacker_id = s.hacker_id
WHERE s.score = d.score
) AS t
GROUP BY hacker_id, name HAVING times_max > 1 ORDER BY times_max DESC, hacker_id ASC
)AS tt;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Top Competitors
You are viewing a single comment's thread. Return to all comments →
SELECT tt.hacker_id, tt.name FROM ( SELECT t.hacker_id, t.name, COUNT(hacker_id) AS times_max FROM ( SELECT h.name AS name, c.challenge_id AS challenge_id, c.difficulty_level AS difficulty_level, d.score AS max_score, s.hacker_id AS hacker_id, s.score AS user_score FROM challenges AS c JOIN difficulty AS d ON d.difficulty_level = c.difficulty_level JOIN submissions AS s ON c.challenge_id = s.challenge_id JOIN hackers AS h ON h.hacker_id = s.hacker_id WHERE s.score = d.score ) AS t GROUP BY hacker_id, name HAVING times_max > 1 ORDER BY times_max DESC, hacker_id ASC )AS tt;