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
beginner
In a LEFT JOIN, what happens if there is no matching row in the right table?
The query still returns the row from the left table, but the columns from the right table will have NULL values.
Click to reveal answer
beginner
Write a simple SQL LEFT JOIN query to get all customers and their orders, including customers with no orders.
SELECT customers.id, customers.name, orders.id AS order_id FROM customers LEFT JOIN orders ON customers.id = orders.customer_id;
Click to reveal answer
intermediate
Why is LEFT JOIN useful when you want to preserve all rows from the left table?
Because it ensures no rows from the left table are lost, even if there are no matching rows in the right table. This helps to keep all original data from the left side.
Click to reveal answer
beginner
What is the difference between INNER JOIN and LEFT JOIN?
INNER JOIN returns only rows with matching keys in both tables. LEFT JOIN returns all rows from the left table, with matching rows from the right or NULL if no match.
Click to reveal answer
What will a LEFT JOIN return if the right table has no matching rows?
✗ Incorrect
LEFT JOIN keeps all rows from the left table and fills right table columns with NULL if no match.
Which SQL keyword is used to keep all rows from the left table regardless of matches?
✗ Incorrect
LEFT JOIN returns all rows from the left table and matched rows from the right.
If you want to find customers without orders, which join helps you?
✗ Incorrect
LEFT JOIN includes all customers, even those without orders, showing NULL for missing orders.
In a LEFT JOIN, what does a NULL in the right table columns mean?
✗ Incorrect
NULL in right table columns means no matching row was found for that left table row.
Which join type would exclude rows from the left table if no match is found?
✗ Incorrect
INNER JOIN returns only rows with matches in both tables, excluding unmatched left rows.
Explain how a LEFT JOIN preserves all rows from the left table and what happens when there is no match in the right table.
Think about what happens to unmatched rows on the right side.
You got /3 concepts.
Write a simple SQL query using LEFT JOIN to list all employees and their departments, including employees without a department.
Use employee table as left and department table as right.
You got /4 concepts.