Bird
0
0

Which of the following is the correct syntax to join three tables A, B, and C on columns A.id = B.a_id and B.id = C.b_id?

easy📝 Syntax Q12 of 15
SQL - Advanced Joins
Which of the following is the correct syntax to join three tables A, B, and C on columns A.id = B.a_id and B.id = C.b_id?
ASELECT * FROM A, B, C WHERE A.id = B.a_id, B.id = C.b_id;
BSELECT * FROM A JOIN B ON A.id = B.a_id, C ON B.id = C.b_id;
CSELECT * FROM A JOIN B JOIN C ON A.id = B.a_id AND B.id = C.b_id;
DSELECT * FROM A JOIN B ON A.id = B.a_id JOIN C ON B.id = C.b_id;
Step-by-Step Solution
Solution:
  1. Step 1: Check JOIN syntax for multiple tables

    Each JOIN must have its own ON condition to specify how tables connect.
  2. Step 2: Validate SELECT * FROM A JOIN B ON A.id = B.a_id JOIN C ON B.id = C.b_id;

    SELECT * FROM A JOIN B ON A.id = B.a_id JOIN C ON B.id = C.b_id; correctly joins A to B with ON, then B to C with ON separately.
  3. Final Answer:

    SELECT * FROM A JOIN B ON A.id = B.a_id JOIN C ON B.id = C.b_id; -> Option D
  4. Quick Check:

    Each JOIN needs its own ON condition [OK]
Quick Trick: Use separate ON for each JOIN clause [OK]
Common Mistakes:
MISTAKES
  • Combining multiple ON conditions in one JOIN
  • Using commas with JOIN incorrectly
  • Missing ON clause for a JOIN

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes