CJCoding With Joseph
15free / daySign inCreate account

Students With Five or More Enrollments

Find the students with five or more enrollments of any status. Return first_name, last_name and enrollments (the count), sorted by last_name. Build the counts in a derived table (a SELECT inside FROM, aliased t) and join it to students.

Expected result:

+------------+-----------+-------------+
| first_name | last_name | enrollments |
+------------+-----------+-------------+
| Charlotte  | Dubois    |           5 |
| Grace      | Lee       |           5 |
| Liam       | Nguyen    |           5 |
| Emily      | Zhang     |           5 |
+------------+-----------+-------------+
4 rows
Hints3 available
Topics:
Subqueries
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.