- Prepare
- SQL
- Basic Join
- Top Competitors
- Discussions
Top Competitors
Top Competitors
+ 0 comments select submissions.hacker_id,hackers.name from hackers inner join submissions on hackers.hacker_id=submissions.hacker_id inner join challenges on challenges.challenge_id=submissions.challenge_id inner join difficulty on challenges.difficulty_level=difficulty.difficulty_level where difficulty.score=submissions.score group by submissions.hacker_id,hackers.name having count(hackers.name)>1 order by count(hackers.name) desc,submissions.hacker_id asc
+ 1 comment Plz someone help me ,what's wrong in this query. select a.hacker_id, a.name from hackers a join submissions b on a.hacker_id= b.hacker_id where b.challenge_id in (select a.challenge_id from challenges a join difficulty b on a.difficulty_level=b.difficulty_level) and b.score in (select a.score from difficulty a join challenges b on a.difficulty_level=b.difficulty_level) group by a.hacker_id having count(a.hacker_id)>1 order by count(a.hacker_id) desc, a.hacker_id asc
+ 0 comments MYSQL:
select s.hacker_id, h.name from submissions as s inner join Challenges as c on s.challenge_id=c.challenge_id inner join Difficulty as d on d.difficulty_level=c.difficulty_level inner join Hackers as h on h.hacker_id=s.hacker_id where d.score=s.score group by s.hacker_id,h.name having count(*)>1 order by count(*) desc, s.hacker_id;
+ 0 comments MySQL:
SELECT hacker_id, name FROM ( SELECT H.hacker_id, name, COUNT(challenge_id) AS ct FROM Submissions AS S LEFT JOIN Hackers AS H USING (hacker_id) LEFT JOIN Challenges USING (challenge_id) LEFT JOIN Difficulty AS D USING (difficulty_level) WHERE S.score = D.score GROUP BY H.hacker_id, name HAVING ct > 1 ORDER BY ct DESC, H.hacker_id ASC ) AS rankings;
+ 0 comments select h.Hacker_ID, Name from submissions s join challenges c on s.challenge_id=c.challenge_id join difficulty d on d.difficulty_level=c.difficulty_level join Hackers h on s.hacker_id=h.hacker_id
where s.score=d.score group by h.Hacker_ID, Name having count(submission_id)>1 order by count(submission_id) desc,h.Hacker_ID
Sort 1688 Discussions, By:
Please Login in order to post a comment