Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion advanced-join/interviews.sql
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ GROUP BY
,total_submissions
,total_accepted_submissions
)

SELECT
contest_id
, c.hacker_id
Expand All @@ -50,4 +51,4 @@ GROUP BY
, c.hacker_id
, c.name
ORDER BY
contest_id;
contest_id;
5 changes: 4 additions & 1 deletion advanced-join/projects.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
-- Projects
-- https://www.hackerrank.com/challenges/projects/problem

set @row1:=0; set @row2:=0; select p_start.start_date,p_end.end_date from (select @row1:=@row1+1 as rown, start_date from projects where start_date not in (select end_date from projects)) as p_start inner join (select @row2:=@row2+1 as rown, end_date from projects where end_date not in (select start_date from projects)) as p_end on p_start.rown=p_end.rown order by p_end.end_date-p_start.start_date,p_start.start_date;
set @row1:=0; set @row2:=0; select p_start.start_date,p_end.end_date from
(select @row1:=@row1+1 as rown, start_date from projects where start_date not in (select end_date from projects))
as p_start inner join (select @row2:=@row2+1 as rown, end_date from projects where end_date not in
(select start_date from projects)) as p_end on p_start.rown=p_end.rown order by p_end.end_date-p_start.start_date,p_start.start_date;
3 changes: 2 additions & 1 deletion alternative-queries/draw_the_triangle_2.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-- Draw The Triangle 2
-- https://www.hackerrank.com/challenges/draw-the-triangle-2/problem

SELECT REPEAT('* ', @NUMBER := @NUMBER + 1) FROM information_schema.tables, (SELECT @NUMBER:=0) t LIMIT 20

SELECT REPEAT('* ', @NUMBER := @NUMBER + 1) FROM information_schema.tables, (SELECT @NUMBER:=0) t LIMIT 20