- Prepare
- SQL
- Basic Join
- Top Competitors
- Discussions
Top Competitors
Top Competitors
+ 0 comments SELECT Submissions.hacker_id, Hackers.name FROM Submissions INNER JOIN Hackers ON Submissions.hacker_id = Hackers.hacker_id INNER JOIN Challenges ON Submissions.challenge_id = Challenges.challenge_id INNER JOIN Difficulty ON Difficulty.difficulty_level = Challenges.difficulty_level WHERE Submissions.score=Difficulty.score GROUP BY 1,2 HAVING COUNT()>1 ORDER BY COUNT() DESC, Submissions.hacker_id ASC;
+ 1 comment I still did not get it why we join Submissions table and Challenges table on challenge_id not hacker_id?. Please enlighten me
+ 0 comments 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 c.difficulty_level=d.difficulty_level where d.score=s.score group by h.hacker_id,h.name having count(c.challenge_id)>1 order by count(c.challenge_id) desc, h.hacker_id
+ 0 comments This is my submission :
SELECT S.hacker_id, H.name FROM Submissions AS S JOIN Challenges AS C ON S.challenge_id = C.challenge_id JOIN Difficulty AS D ON C.difficulty_level = D.difficulty_level JOIN Hackers AS H ON H.hacker_id = S.hacker_id WHERE D.score = S.score GROUP BY 1, 2 HAVING COUNT(S.hacker_id) > 1 ORDER BY COUNT(S.challenge_id) DESC, S.hacker_id
+ 0 comments MYSQL select s.hacker_id, h.name from submissions as s join hackers as h on s.hacker_id=h.hacker_id join challenges as C on s.challenge_id=C.challenge_id join difficulty as D on C.difficulty_level=D.difficulty_level where s.score=D.score group by 1,2 having count(C.challenge_id)>1 order by count(C.challenge_id) desc, 1
Sort 1832 Discussions, By:
Please Login in order to post a comment