Bird
0
0

Find the mistake in this query:

medium📝 Debug Q7 of 15
SQL - INNER JOIN
Find the mistake in this query:
SELECT * FROM Orders INNER JOIN Customers ON Orders.CustomerID = Customers.ID AND Customers.Region = 'East' OR Customers.Region = 'West';
AIncorrect use of OR without parentheses causing wrong join logic
BMissing JOIN keyword
CUsing WHERE instead of ON for join conditions
DNo mistake, query is correct
Step-by-Step Solution
Solution:
  1. Step 1: Analyze join condition logic

    AND and OR without parentheses can cause unexpected evaluation order.
  2. Step 2: Identify logical error

    OR should be grouped with parentheses to apply correctly to join conditions.
  3. Final Answer:

    Incorrect use of OR without parentheses causing wrong join logic -> Option A
  4. Quick Check:

    Use parentheses to clarify AND/OR in join conditions [OK]
Quick Trick: Use parentheses to group AND/OR in ON clause [OK]
Common Mistakes:
MISTAKES
  • Ignoring operator precedence in ON clause
  • Assuming AND and OR have equal precedence
  • Not grouping conditions properly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes