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.
Why the expected output of the Problem is not provided? I am still not able to understand what is wrong in the below query??
SELECT cs.contest_id
,cs.hacker_id
,cs.name
,sum(nvl(ss.total_submissions,0)) as total_submissions
,sum(nvl(ss.total_accepted_submissions,0)) as total_accepted_submissions
,sum(nvl(vs.total_views,0)) as total_views
,sum(nvl(vs.total_unique_views,0)) as total_unique_views
FROM Contests cs LEFT OUTER JOIN Colleges co
on cs.contest_id = co.contest_id
LEFT OUTER JOIN Challenges ch
on co.college_id = ch.college_id
LEFT OUTER JOIN Submission_Stats ss
on ch.challenge_id = ss.challenge_id
LEFT OUTER JOIN View_Stats vs
on ch.challenge_id = vs.challenge_id
group by cs.contest_id, cs.hacker_id, cs.name
having (sum(nvl(ss.total_submissions,0)) + sum(nvl(ss.total_accepted_submissions,0)) + sum(nvl(vs.total_views,0)) + sum(nvl(vs.total_unique_views,0)) ) > 0
order by cs.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 →
Why the expected output of the Problem is not provided? I am still not able to understand what is wrong in the below query??
SELECT cs.contest_id ,cs.hacker_id ,cs.name ,sum(nvl(ss.total_submissions,0)) as total_submissions ,sum(nvl(ss.total_accepted_submissions,0)) as total_accepted_submissions ,sum(nvl(vs.total_views,0)) as total_views ,sum(nvl(vs.total_unique_views,0)) as total_unique_views FROM Contests cs LEFT OUTER JOIN Colleges co on cs.contest_id = co.contest_id LEFT OUTER JOIN Challenges ch on co.college_id = ch.college_id LEFT OUTER JOIN Submission_Stats ss on ch.challenge_id = ss.challenge_id LEFT OUTER JOIN View_Stats vs on ch.challenge_id = vs.challenge_id group by cs.contest_id, cs.hacker_id, cs.name having (sum(nvl(ss.total_submissions,0)) + sum(nvl(ss.total_accepted_submissions,0)) + sum(nvl(vs.total_views,0)) + sum(nvl(vs.total_unique_views,0)) ) > 0 order by cs.contest_id;