0
0
SQLquery~5 mins

Multiple LEFT JOINs in one query in SQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does a LEFT JOIN do in SQL?
A LEFT JOIN returns all rows from the left table and the matched rows from the right table. If there is no match, the result is NULL on the right side.
Click to reveal answer
intermediate
How do multiple LEFT JOINs work in one SQL query?
Multiple LEFT JOINs add more tables to the query, joining each one to the previous result. Each join keeps all rows from the left side, adding matching rows or NULLs from the right side.
Click to reveal answer
beginner
Write a simple SQL query using two LEFT JOINs.
SELECT a.id, b.name, c.status FROM tableA a LEFT JOIN tableB b ON a.id = b.a_id LEFT JOIN tableC c ON a.id = c.a_id;
Click to reveal answer
beginner
Why might you get NULL values in columns from tables joined with LEFT JOIN?
Because LEFT JOIN keeps all rows from the left table, if there is no matching row in the right table, the columns from the right table will show NULL.
Click to reveal answer
intermediate
What is the difference between INNER JOIN and multiple LEFT JOINs?
INNER JOIN returns only rows with matches in both tables. Multiple LEFT JOINs return all rows from the left table and matching rows or NULLs from each joined table.
Click to reveal answer
What will a LEFT JOIN return if there is no matching row in the right table?
AAll rows from the left table with NULLs for the right table columns
BOnly matching rows from both tables
CAll rows from the right table
DNo rows
In a query with multiple LEFT JOINs, what happens if the second joined table has no matching rows?
AAn error occurs
BThe entire query returns no rows
COnly rows with matches in the second table appear
DRows from the left table still appear with NULLs for the second joined table
Which SQL keyword is used to join tables and keep all rows from the left table?
AINNER JOIN
BRIGHT JOIN
CLEFT JOIN
DFULL JOIN
If you want to join three tables and keep all rows from the first table, which join type should you use?
ALEFT JOIN for all
BINNER JOIN for all
CRIGHT JOIN for all
DFULL JOIN for all
What does the ON clause specify in a LEFT JOIN?
AThe columns to select
BThe condition to match rows between tables
CThe order of rows
DThe filter for the left table only
Explain how multiple LEFT JOINs work in a SQL query and why they might be useful.
Think about combining data from several tables while keeping all main records.
You got /4 concepts.
    Describe the difference between INNER JOIN and multiple LEFT JOINs in terms of returned rows.
    Focus on how unmatched rows are handled.
    You got /4 concepts.