Students with no enrollment
Easysqlleft joinnull
Return the name of every student with no row in enrollments, sorted by name.
Tables
- students (id INTEGER, name TEXT, city TEXT, xp INTEGER)
- enrollments (student_id INTEGER, course_id INTEGER)
Example 1
students
| id | name | city | xp |
|---|---|---|---|
| 1 | Mona | Cairo | 10 |
| 2 | Omar | Giza | 20 |
| 3 | Laila | Cairo | 30 |
enrollments
| student_id | course_id |
|---|---|
| 1 | 10 |
| 1 | 11 |
| 3 | 10 |
Expected result
| name |
|---|
| Omar |
Constraints
- 0 ≤ rows ≤ 1000
- The order of rows matters
Submit checks your solution against 7 tests, including hidden ones.
SQL
-- Write one SELECT query. Tables: students, enrollments SELECT