CJCoding With Joseph
15free / daySign inCreate account

Purge the Unpaid Dropped Enrollments

Four enrollments were dropped (ids 23, 26, 38 and 55). Delete only the dropped ones that were never paid for, status 'dropped' and paid 0, which is ids 26 and 55. Ids 23 and 38 were dropped but paid, so they stay, and the table ends with 88 rows.

Expected result:

enrollments after your statements: 88 rows
+----+------------+-----------+-------------+-------+--------+-----------+----------------+------+---------------------+
| id | student_id | course_id | enrolled_on | grade | letter | status    | attendance_pct | paid | notes               |
+----+------------+-----------+-------------+-------+--------+-----------+----------------+------+---------------------+
|  1 |          5 |         9 | 2024-09-03  |    78 | B      | completed |           92.5 |    1 | NULL                |
|  2 |          5 |         7 | 2024-09-03  |    81 | B      | completed |             88 |    1 | NULL                |
|  3 |         10 |        11 | 2024-09-04  |    74 | B      | completed |             79 |    1 | NULL                |
|  4 |         10 |         7 | 2024-09-04  |    69 | C      | completed |           71.5 |    1 | Late essay accepted |
|  5 |         15 |         5 | 2024-09-05  |    97 | A      | completed |             98 |    1 | NULL                |
+----+------------+-----------+-------------+-------+--------+-----------+----------------+------+---------------------+
(showing 5 of 88 rows)
Hints3 available
Topics:
INSERT, UPDATE & DELETE
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.