← Back to Joins
Question 105
Courses in Progress per Student
Courses in Progress per Student
For every student, count how many courses they are taking right now: enrollments whosestatusis'enrolled'. Returnfirst_name,last_nameandin_progress(the count). All 30 students must appear; the eight with nothing in progress show 0. Sort byin_progressdescending, thenlast_name, thenfirst_name.
Expected result:
+------------+-----------+-------------+ | first_name | last_name | in_progress | +------------+-----------+-------------+ | Oliver | Brown | 2 | | Charlotte | Dubois | 2 | | Noah | Kim | 2 | | Abigail | Larsen | 2 | | Grace | Lee | 2 | | James | Mensah | 2 | | Ella | Murphy | 2 | | Liam | Nguyen | 2 | | Ava | Patel | 2 | | Sophia | Rossi | 2 | +------------+-----------+-------------+ (showing 10 of 30 rows)
Hints4 available
Sign in to use hintsTopics:
Joins
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (sel, ins, desc)
Results
Run your SQL to see every statement's output here, then how it compares with the expected answer.
Not sure what is in a table? SHOW TABLES lists them and DESCRIBE students shows the columns — or open the database browser on the left.