Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A row in table submissions contains a submission (submission_id) made by a student (student_id) to a contest (contest_id) and the score of the corresponding submission
- A row in table submissions contains a submission (submission_id) made by a student (student_id) to a contest (contest_id) and the score of the corresponding submission (score).
- A student (student_id) can make multiple submissions (submission_id) to the same contest (contest_id) and earn a different score (score) every time.
- The total score of a student is the sum of their maximum scores (score) of all contests (contest_id).
Write an SQL statement to query the student_id, name, and total score of the students. Order the results by first the score (in descending order) and then the student_id (in ascending order). Do not include students with a zero total score in your results.
Given tables students and submissions with the following schemas, Column student_id students Type INTEGER TEXT name submissions Column Type submission_id INTEGER student_id INTEGER contest_id INTEGER score INTEGER A row in table submissions contains a submission (submission_id) made by a student (student_id) to a contest (contest_id) and the score of the corresponding submission (score) A student (student_id) can make multiple submissions (submission_id) to the same contest (contest_id) and earn a different score (score) every time. The total score of a student is the sum of their maximum scores (score) of all contests (contest_id). Write an SQL statement to query the student_id, name, and total score of the students. Order the results by first the score (in descending order) and then the student_id (in ascending order). Do not include students with a zero total score in your resultsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started