Delete enrollments that have no marks
Easy · School database · DELETE, NULL values
Some enrollments have no marks yet: their marks is NULL. They were entered by mistake.
Delete those rows from the enrollments table and leave every other row as it is.
After your SQL, this query shows
SELECT * FROM enrollments ORDER BY id;
| id | student_id | course_id | marks | enrolled_on |
|---|---|---|---|---|
| 1 | 1 | 1 | 88 | 2025-04-07 |
| 2 | 1 | 3 | 88 | 2025-04-07 |
| 3 | 2 | 2 | 91 | 2025-04-08 |
| 4 | 2 | 4 | 86 | 2025-04-08 |
| 5 | 3 | 1 | 72 | 2025-04-09 |
| 6 | 3 | 3 | 67 | 2025-04-09 |
| 7 | 4 | 2 | 85 | 2025-04-10 |
| 8 | 4 | 4 | 92 | 2025-04-10 |
| 9 | 5 | 3 | 58 | 2025-04-11 |
| 10 | 5 | 9 | 90 | 2025-05-02 |
| 11 | 6 | 2 | 68 | 2025-04-11 |
| 12 | 6 | 5 | 75 | 2025-04-14 |
| 13 | 7 | 1 | 97 | 2025-04-14 |
| 14 | 7 | 3 | 82 | 2025-04-14 |
| 15 | 8 | 4 | 78 | 2025-04-15 |
| 16 | 8 | 7 | 73 | 2025-05-06 |
| 17 | 9 | 1 | 64 | 2025-04-16 |
| 18 | 9 | 3 | 95 | 2025-04-16 |
| 19 | 9 | 6 | 98 | 2025-05-06 |
| 20 | 10 | 4 | 78 | 2025-04-17 |
| 21 | 10 | 5 | 93 | 2025-04-17 |
| 22 | 18 | 1 | 81 | 2025-05-12 |
| 23 | 20 | 6 | 66 | 2025-05-13 |
| 24 | 23 | 6 | 87 | 2025-05-14 |
| 25 | 23 | 7 | 91 | 2025-05-14 |
| 26 | 11 | 5 | 74 | 2025-06-02 |
| 27 | 11 | 3 | 95 | 2025-06-02 |
| 28 | 12 | 5 | 84 | 2025-06-03 |
| 29 | 12 | 7 | 80 | 2025-06-03 |
| 30 | 13 | 3 | 71 | 2025-06-04 |
First 30 of 37 rows.
The school tables
courses: 10 rows, first 5 shown
| id | name | teacher_id | credits |
|---|---|---|---|
| 1 | Physics | 1 | 4 |
| 2 | Chemistry | 2 | 4 |
| 3 | Mathematics | 3 | 5 |
| 4 | English | 4 | 3 |
| 5 | Biology | 5 | 4 |
enrollments: 40 rows, first 5 shown
| id | student_id | course_id | marks | enrolled_on |
|---|---|---|---|---|
| 1 | 1 | 1 | 88 | 2025-04-07 |
| 2 | 1 | 3 | 88 | 2025-04-07 |
| 3 | 2 | 2 | 91 | 2025-04-08 |
| 4 | 2 | 4 | 86 | 2025-04-08 |
| 5 | 3 | 1 | 72 | 2025-04-09 |
students: 24 rows, first 5 shown
| id | name | gender | class | section | city | dob | |
|---|---|---|---|---|---|---|---|
| 1 | Aarav Sharma | M | 12 | A | Delhi | 2008-05-14 | aarav.sharma@example.com |
| 2 | Priya Nair | F | 12 | A | Kochi | 2008-09-02 | priya.nair@example.com |
| 3 | Rohan Gupta | M | 12 | B | Delhi | 2008-01-23 | NULL |
| 4 | Ananya Iyer | F | 12 | B | Chennai | 2008-11-30 | ananya.iyer@example.com |
| 5 | Kabir Singh | M | 12 | C | Chandigarh | 2007-12-19 | kabir.singh@example.com |
teachers: 8 rows, first 5 shown
| id | name | subject | city | joined_on |
|---|---|---|---|---|
| 1 | Sunita Mehra | Physics | Delhi | 2012-06-01 |
| 2 | Rajesh Kumar | Chemistry | Delhi | 2015-07-15 |
| 3 | Lakshmi Krishnan | Mathematics | Chennai | 2010-04-01 |
| 4 | David Thomas | English | Kochi | 2018-06-20 |
| 5 | Farah Qureshi | Biology | Mumbai | 2016-08-01 |
-- Write your SQL here