Docker Handson 2 |
Contests.contest_id, Contests.hacker_id, Contests.name,
(Submission_Stats.total_submissions + Submission_Stats.total_accepted_submissions +
View_Stats.total_views + View_Stats.total_unique_views)
FROM Contests
INNER JOIN Colleges ON Contest.contest_id = Colleges.contest_id
INNER JOIN Challenges ON Colleges.college_id = Challenges.college_id
INNER JOIN Submission_Stats ON Challenges.challenge_id = Submission_Stats.challenge_id
INNER JOIN View_Stats ON Challenges.challenge_id = View_Stats.challenge_id
ORDER BY contest_id
Contests, Colleges, Challenges, Submission_Stats, View_Stats
SELECT
Contests.contest_id, hacker_id, name,
SUM(Submission_Stats.total_submissions),
SUM(Submission_Stats.total_accepted_submissions),
SUM(View_Stats.total_views),
SUM(View_Stats.total_unique_views)
FROM Contests
INNER JOIN Colleges ON Contest.contest_id = Colleges.contest_id
INNER JOIN Challenges ON Colleges.college_id = Challenges.college_id
INNER JOIN Submission_Stats ON Challenges.challenge_id = Submission_Stats.challenge_id
INNER JOIN View_Stats ON Challenges.challenge_id = View_Stats.challenge_id
ORDER BY Contests.contest_id
}
Contest.contest_id = Colleges.contest_id AND
Colleges.college_id = Challenges.college_id AND
Challenges.challenge_id = Submission_Stats.challenge_id AND
Challenges.challenge_id = View_Stats.challenge_id
ORDER BY Contests.contest_id ASC
*/
Disclaimer: This site is for pure educational purpose only. we
recommend it only for reference. we still encourage to go through the course
and learn the topics
Post a Comment