Finding Highest Grade and Corresponding Course per Student
 

Using the table playground.student_grades, write a SQL query to find the highest grade and its corresponding course for each student. In cases where there is a tie for the highest grade, select the course with the smallest course_id. The output should include student_id, course_id, and the grade, with the results sorted by increasing student_id.

These are the tables to query for this question:
playground.student_grades
  • student_id int
  • course_id int
  • grade int
Your answer should include these columns:
  • student_id integer
  • course_id integer
  • grade integer

Querying is only for logged in users!

Write Your Query Here (you can run selections by highlighting!)

Query Results

No queries have been run yet.