Bird
0
0

Which of the following is the correct syntax for an INNER JOIN between tables Orders and Customers on customer_id using the ON clause?

easy📝 Syntax Q3 of 15
SQL - INNER JOIN
Which of the following is the correct syntax for an INNER JOIN between tables Orders and Customers on customer_id using the ON clause?
ASELECT * FROM Orders INNER JOIN Customers ON Orders.customer_id = Customers.customer_id;
BSELECT * FROM Orders JOIN Customers WHERE Orders.customer_id = Customers.customer_id;
CSELECT * FROM Orders INNER JOIN Customers USING customer_id;
DSELECT * FROM Orders INNER JOIN Customers ON Orders.id = Customers.id;
Step-by-Step Solution
Solution:
  1. Step 1: Check correct INNER JOIN syntax

    INNER JOIN requires ON clause with matching columns; SELECT * FROM Orders INNER JOIN Customers ON Orders.customer_id = Customers.customer_id; uses correct syntax with matching customer_id columns.
  2. Step 2: Evaluate other options

    SELECT * FROM Orders JOIN Customers WHERE Orders.customer_id = Customers.customer_id; uses WHERE instead of ON, which is incorrect syntax for JOIN condition. SELECT * FROM Orders INNER JOIN Customers USING customer_id; uses USING but only valid if both tables have exactly the same column name and is less explicit. SELECT * FROM Orders INNER JOIN Customers ON Orders.id = Customers.id; joins on wrong columns (id instead of customer_id).
  3. Final Answer:

    SELECT * FROM Orders INNER JOIN Customers ON Orders.customer_id = Customers.customer_id; -> Option A
  4. Quick Check:

    Correct INNER JOIN syntax uses ON with matching columns [OK]
Quick Trick: Use ON clause with matching columns for INNER JOIN [OK]
Common Mistakes:
MISTAKES
  • Using WHERE instead of ON for join condition
  • Joining on wrong columns
  • Confusing USING with ON syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes