Bird
0
0

Which SQL query correctly demonstrates the use of multiple LEFT JOIN clauses to combine tables authors, books, and reviews?

easy📝 Syntax Q3 of 15
SQL - LEFT and RIGHT JOIN
Which SQL query correctly demonstrates the use of multiple LEFT JOIN clauses to combine tables authors, books, and reviews?
ASELECT a.name, b.title, r.rating FROM authors a LEFT JOIN books b ON b.author_id = a.id INNER JOIN reviews r ON r.book_id = b.id;
BSELECT a.name, b.title, r.rating FROM authors a INNER JOIN books b ON a.id = b.author_id LEFT JOIN reviews r ON b.id = r.book_id;
CSELECT a.name, b.title, r.rating FROM authors a LEFT JOIN books b ON a.id = b.author_id LEFT JOIN reviews r ON b.id = r.book_id;
DSELECT a.name, b.title, r.rating FROM authors a RIGHT JOIN books b ON a.id = b.author_id LEFT JOIN reviews r ON b.id = r.book_id;
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct JOIN types

    Multiple LEFT JOINs preserve all authors, even if they have no books or reviews.
  2. Step 2: Check join conditions

    Joins must correctly link authors to books and books to reviews using foreign keys.
  3. Final Answer:

    SELECT a.name, b.title, r.rating FROM authors a LEFT JOIN books b ON a.id = b.author_id LEFT JOIN reviews r ON b.id = r.book_id; correctly uses LEFT JOINs with proper ON clauses.
  4. Quick Check:

    LEFT JOINs preserve left table rows [OK]
Quick Trick: Use LEFT JOINs to keep all rows from first table [OK]
Common Mistakes:
MISTAKES
  • Mixing INNER JOIN and LEFT JOIN incorrectly
  • Using RIGHT JOIN instead of LEFT JOIN
  • Incorrect ON clause conditions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes