Bird
0
0

Consider tables:

medium📝 query result Q5 of 15
SQL - Table Relationships
Consider tables:
Students(id, name)
Enrollments(student_id, course)
What does this query return?
SELECT Students.name FROM Students LEFT JOIN Enrollments ON Students.id = Enrollments.student_id WHERE Enrollments.course IS NULL;
AStudents enrolled in at least one course
BError due to incorrect JOIN syntax
CAll students with their courses
DStudents who are not enrolled in any course
Step-by-Step Solution
Solution:
  1. Step 1: Understand LEFT JOIN with NULL filter

    LEFT JOIN keeps all students; WHERE Enrollments.course IS NULL filters those without matching enrollments.
  2. Step 2: Interpret result

    The query returns students who have no courses enrolled.
  3. Final Answer:

    Students who are not enrolled in any course -> Option D
  4. Quick Check:

    LEFT JOIN + NULL filter = unmatched rows [OK]
Quick Trick: LEFT JOIN with NULL filter finds unmatched rows [OK]
Common Mistakes:
MISTAKES
  • Confusing LEFT JOIN with INNER JOIN
  • Ignoring NULL filter effect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes