Bird
0
0

You wrote this query:

medium📝 Debug Q6 of 15
SQL - Advanced Joins
You wrote this query:
SELECT * FROM A FULL OUTER JOIN B ON A.ID = B.ID WHERE A.Name = 'John';

But it returns fewer rows than expected. What is the likely issue?
AThe WHERE clause filters out rows where A.Name is NULL, removing unmatched rows from B.
BFULL OUTER JOIN does not support WHERE clauses.
CThe ON condition is incorrect and causes no matches.
DThe query syntax is invalid for FULL OUTER JOIN.
Step-by-Step Solution
Solution:
  1. Step 1: Understand WHERE clause effect after FULL OUTER JOIN

    WHERE filters rows after the join, so rows with NULL in A.Name (unmatched from B) are excluded.
  2. Step 2: Identify impact on result

    This removes unmatched rows from B, reducing rows returned.
  3. Final Answer:

    The WHERE clause filters out rows where A.Name is NULL, removing unmatched rows from B. -> Option A
  4. Quick Check:

    WHERE filters after join, can exclude NULLs = A [OK]
Quick Trick: Use WHERE carefully with FULL OUTER JOIN to avoid losing unmatched rows [OK]
Common Mistakes:
MISTAKES
  • Thinking WHERE filters before join
  • Assuming FULL OUTER JOIN ignores WHERE

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes