LEFT JOIN to Find Gaps
LEFT JOIN keeps every left row. Unmatched right columns become NULL, which finds missing relations.
Example
SELECT s.name
FROM students s
LEFT JOIN enrolments e ON e.student_id = s.id
WHERE e.student_id IS NULL;Result
name Wanjiru Sipho Esi
Exercise
Keep all left rows.
FROM a JOIN b
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.