We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
select c.contest_id, c.hacker_id, c.name, sum(vs.total_views), sum(vs.total_unique_views), sum(ss.total_submissions), sum(ss.total_accepted_submissions)
from contests c left join Colleges Col on c.contest_id = col.contest_id left join Challenges ch on col.college_id = ch.college_id left join View_Stats VS on ch.challenge_id = vs.challenge_id left join Submission_Stats SS on ch.challenge_id = ss.challenge_id
group by c.contest_id, c.hacker_id, c.name
having sum(vs.total_views) + sum(vs.total_unique_views) + sum(ss.total_submissions) + sum(ss.total_accepted_submissions) > 0
order by c.contest_id
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Interviews
You are viewing a single comment's thread. Return to all comments →
what is wrong with this query
select c.contest_id, c.hacker_id, c.name, sum(vs.total_views), sum(vs.total_unique_views), sum(ss.total_submissions), sum(ss.total_accepted_submissions) from contests c left join Colleges Col on c.contest_id = col.contest_id left join Challenges ch on col.college_id = ch.college_id left join View_Stats VS on ch.challenge_id = vs.challenge_id left join Submission_Stats SS on ch.challenge_id = ss.challenge_id group by c.contest_id, c.hacker_id, c.name having sum(vs.total_views) + sum(vs.total_unique_views) + sum(ss.total_submissions) + sum(ss.total_accepted_submissions) > 0 order by c.contest_id