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.
WITH ch_counts AS (
SELECT
st.hacker_id AS hacker_id,
h.name AS name,
COUNT(st.hacker_id) as num_challenges
FROM Submissions st
JOIN Challenges c ON st.challenge_id = c.challenge_id
JOIN Difficulty d ON d.difficulty_level = c.difficulty_level
JOIN Hackers h ON h.hacker_id = st.hacker_id
WHERE st.score = d.score AND c.difficulty_level = d.difficulty_level
GROUP BY st.hacker_id, h.name
HAVING COUNT(st.hacker_id) > 1
)
SELECT hacker_id,
name
--num_challenges
FROM ch_counts
ORDER BY num_challenges DESC, hacker_id
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 →
WITH ch_counts AS ( SELECT st.hacker_id AS hacker_id, h.name AS name, COUNT(st.hacker_id) as num_challenges FROM Submissions st JOIN Challenges c ON st.challenge_id = c.challenge_id JOIN Difficulty d ON d.difficulty_level = c.difficulty_level JOIN Hackers h ON h.hacker_id = st.hacker_id WHERE st.score = d.score AND c.difficulty_level = d.difficulty_level GROUP BY st.hacker_id, h.name HAVING COUNT(st.hacker_id) > 1
) SELECT hacker_id, name --num_challenges FROM ch_counts ORDER BY num_challenges DESC, hacker_id