Skip to content

Commit ad33898

Browse files
authored
Create Top Competitors.sql
1 parent 69c5cd6 commit ad33898

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Basic Join/Top Competitors.sql

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
SELECT h.hacker_id,
2+
h.NAME
3+
FROM submissions s
4+
LEFT JOIN hackers h
5+
ON s.hacker_id = h.hacker_id
6+
LEFT JOIN challenges c
7+
ON s.challenge_id = c.challenge_id
8+
LEFT JOIN difficulty d
9+
ON c.difficulty_level = d.difficulty_level
10+
WHERE s.score = d.score
11+
GROUP BY h.hacker_id
12+
HAVING( Count(*) > 1 )
13+
ORDER BY Count(*) DESC,
14+
s.hacker_id;

0 commit comments

Comments
 (0)