Bird
0
0

Which of the following is the correct syntax to join tables users and orders on user_id?

easy📝 Syntax Q3 of 15
SQL - Advanced Joins
Which of the following is the correct syntax to join tables users and orders on user_id?
ASELECT * FROM users JOIN orders WHERE users.user_id = orders.user_id;
BSELECT * FROM users JOIN orders ON users.user_id = orders.user_id;
CSELECT * FROM users, orders ON users.user_id = orders.user_id;
DSELECT * FROM users JOIN orders USING user_id;
Step-by-Step Solution
Solution:
  1. Step 1: Review JOIN syntax

    The correct syntax uses JOIN ... ON to specify join condition explicitly.
  2. Step 2: Identify correct option

    SELECT * FROM users JOIN orders ON users.user_id = orders.user_id; uses JOIN with ON clause correctly; SELECT * FROM users JOIN orders USING (user_id); uses USING with parentheses.
  3. Final Answer:

    SELECT * FROM users JOIN orders ON users.user_id = orders.user_id; -> Option B
  4. Quick Check:

    Correct JOIN syntax uses ON [OK]
Quick Trick: Use JOIN ... ON for explicit join conditions [OK]
Common Mistakes:
MISTAKES
  • Using WHERE instead of ON for join condition
  • Using comma join with ON clause
  • Incorrect USING syntax without parentheses

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes