Bird
0
0

Find the problem in this query: SELECT * FROM Products FULL OUTER JOIN Sales ON Products.id = Sales.product_id WHERE Sales.amount > 100;

medium📝 Debug Q7 of 15
SQL - LEFT and RIGHT JOIN
Find the problem in this query: SELECT * FROM Products FULL OUTER JOIN Sales ON Products.id = Sales.product_id WHERE Sales.amount > 100;
AWHERE clause filters out NULLs, negating FULL OUTER JOIN effect
BFULL OUTER JOIN syntax is incorrect
CON clause is missing
DNo problem; query is correct
Step-by-Step Solution
Solution:
  1. Step 1: Understand FULL OUTER JOIN

    It returns all rows from both tables, with NULLs where no match exists.
  2. Step 2: Analyze WHERE clause effect

    WHERE Sales.amount > 100 excludes rows where Sales.amount is NULL, removing unmatched rows.
  3. Final Answer:

    WHERE clause filters out NULLs, negating FULL OUTER JOIN effect -> Option A
  4. Quick Check:

    WHERE filters can remove outer join unmatched rows [OK]
Quick Trick: Filter outer join results in ON, not WHERE, to keep NULLs [OK]
Common Mistakes:
MISTAKES
  • Filtering outer join results in WHERE clause
  • Expecting NULLs to remain after WHERE filters
  • Misunderstanding FULL OUTER JOIN behavior

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes