Hard - Q2

mail@pastecode.io avatar
unknown
sql
2 years ago
750 B
3
Indexable
Never
select subs.submission_date, (select count(distinct hacker_id) from submissions X where X.submission_date = subs.submission_date and (select count(distinct submission_date) from submissions where hacker_id = X.hacker_id and subs.submission_date > submission_date) = datediff(subs.submission_date, '2016/03/01')) numHackers,(select hacker_id from submissions where submission_date = subs.submission_date group by hacker_id order by count(submission_id) desc, hacker_id asc limit 1) hackerID,(select name from hackers where hacker_id = hackerID) hackerName from (select distinct submission_date from submissions where submission_date <= '2016-03-15' and submission_date >= '2016-03-01') subs group by subs.submission_date order by subs.submission_date;