Courses in Progress per Student
hardQuestion 105For every student, count how many courses they are taking right now: enrollments whose status is 'enrolled'. Return first_name, last_name and in_progress (the count). All 30 students must appear; the eight with nothing in progress show 0. Sort by in_progress descending, then last_name, then first_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 under the question.