Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The submissions table contains a submission (submission_id) made by a student (student_id) to a contest (contest_id) and the score of the submission (score). A student

image text in transcribed

  • The submissions table contains a submission (submission_id) made by a student (student_id) to a contest (contest_id) and the score of the submission (score). A student can make multiple submissions to the same contest and receive multiple scores.
  • The contests table contains the author (author_id) of their contest submission (contest_id) that belongs to a certain division (division_id).
  • The divisions table contains the max score (score) of each contest that belongs to a certain division (division_id).

Write a SQL query to retrieve the student_id and name of the students who received max scores in more than one contest. Order the results by first the total number contests in which the student earned a full score, and then the student_id (in ascending order).

Given tables students, difficulty, contests, and submissions with the following schemas, students Column Type student_id INTEGER name TEXT divisions Column Type division_id INTEGER INTEGER contests Column Type contest_id INTEGER author_id INTEGER division_id INTEGER submissions Column Type submission_id INTEGER student_id INTEGER contest_id INTEGER score INTEGER The submissions table contains a submission (submission_id) made by a student (student_id) to a contest (contest_id) and the score of the submission (score). A student can make multiple submissions to the same contest and receive multiple scores. The contests table contains the author (author_id) of their contest submission (contest_id) that belongs to a certain division (division_id). The divisions table contains the max score (score) of each contest that belongs to a certain division (division_id). Write a SQL query to retrieve the student_id and name of the students who received max scores in more than one contest. Order the results by first the total number contests in which the student earned a full score, and then the student_id (in ascending order). Given tables students, difficulty, contests, and submissions with the following schemas, students Column Type student_id INTEGER name TEXT divisions Column Type division_id INTEGER INTEGER contests Column Type contest_id INTEGER author_id INTEGER division_id INTEGER submissions Column Type submission_id INTEGER student_id INTEGER contest_id INTEGER score INTEGER The submissions table contains a submission (submission_id) made by a student (student_id) to a contest (contest_id) and the score of the submission (score). A student can make multiple submissions to the same contest and receive multiple scores. The contests table contains the author (author_id) of their contest submission (contest_id) that belongs to a certain division (division_id). The divisions table contains the max score (score) of each contest that belongs to a certain division (division_id). Write a SQL query to retrieve the student_id and name of the students who received max scores in more than one contest. Order the results by first the total number contests in which the student earned a full score, and then the student_id (in ascending order)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions