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.
- Prepare
- SQL
- Basic Join
- Top Competitors
- Discussions
Top Competitors
Top Competitors
Sort by
recency
|
2500 Discussions
|
Please Login in order to post a comment
select h.hacker_id, h.name from hackers h
Inner Join Submissions s on h.hacker_id = s.hacker_id Inner Join Challenges c on s.challenge_id = c.challenge_id Inner join Difficulty d on d.difficulty_level = c.difficulty_level
where s.score = d.score
group by h.hacker_id, h.name
having count(s.challenge_id ) > 1
Order By count(s.challenge_id) desc, hacker_id asc
select h.hacker_id, h.name from hackers h join (select sub.hacker_id hackerId, count(sub.hacker_id) hacker_count from submissions sub join challenges ch on sub.challenge_id=ch.challenge_id join difficulty diff on ch.difficulty_level=diff.difficulty_level where diff.score=sub.score group by(sub.hacker_id)) sl on sl.hackerId=h.hacker_id where hacker_count > 1 order by hacker_count desc, h.hacker_id;
SELECT h.hacker_id, h.name FROM Hackers h JOIN Submissions s ON h.hacker_id = s.hacker_id JOIN Challenges c ON s.challenge_id = c.challenge_id JOIN Difficulty d ON c.difficulty_level = d.difficulty_level WHERE s.score = d.score -- full score GROUP BY h.hacker_id, h.name HAVING COUNT(DISTINCT s.challenge_id) > 1 ORDER BY COUNT(DISTINCT s.challenge_id) DESC, h.hacker_id ASC;
select hacker_id, name from (select h.name, h.hacker_id from hackers h join submissions s on h.hacker_id=s.hacker_id join challenges ch on s.challenge_id=ch.challenge_id join difficulty df on ch.difficulty_level=df.difficulty_level where s.score=df.score order by h.hacker_id) as maxxx group by hacker_id, name having count(name) > 1 order by count(name)desc, hacker_id asc