Skip
Arish's avatar

226. NOT EXISTS


NOT EXISTS

True if subquery returns no rows.

sql
1SELECT * FROM courses c
2WHERE NOT EXISTS (
3  SELECT 1 FROM students WHERE course_id = c.id
4);

Courses without students.