Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What does a LEFT JOIN do in SQL?
A LEFT JOIN returns all rows from the left table and the matching rows from the right table. If there is no match, the result shows NULL for columns from the right table.
Click to reveal answer
beginner
Why do some columns show NULL values after a LEFT JOIN?
Columns from the right table show NULL when there is no matching row for the left table's row in the right table.
Click to reveal answer
beginner
Write a simple 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
beginner
What happens if you use INNER JOIN instead of LEFT JOIN in the same query?
INNER JOIN returns only rows where there is a match in both tables. Customers without orders would be excluded.
Click to reveal answer
intermediate
How can you find rows from the left table that have no matching rows in the right table using LEFT JOIN?
Use a LEFT JOIN and then filter with WHERE right_table.column IS NULL to find unmatched rows.
Click to reveal answer
What does a LEFT JOIN return when there is no matching row in the right table?
AAn error
BNo rows at all
COnly rows from the right table
DRows with NULLs in right table columns
✗ Incorrect
LEFT JOIN returns all rows from the left table and fills NULL for right table columns when no match exists.
Which SQL clause filters rows where the right table has no match after a LEFT JOIN?
AWHERE right_table.column IS NULL
BWHERE left_table.column IS NULL
CWHERE right_table.column = 0
DWHERE left_table.column = 0
✗ Incorrect
Filtering with WHERE right_table.column IS NULL finds rows with no matching right table data.
If you want all rows from the left table regardless of matches, which join do you use?
AINNER JOIN
BLEFT JOIN
CRIGHT JOIN
DFULL JOIN
✗ Incorrect
LEFT JOIN returns all rows from the left table, matching or not.
What will happen if you replace LEFT JOIN with INNER JOIN in a query?
AOnly rows with matches in both tables are returned
BAll rows from the left table are returned
CAll rows from the right table are returned
DNo rows are returned
✗ Incorrect
INNER JOIN returns only rows where both tables have matching data.
In a LEFT JOIN, what does a NULL in the right table columns indicate?
AMatching row with NULL values
BData error
CNo matching row in the right table
DLeft table row is missing
✗ Incorrect
NULL in right table columns means no matching row was found for that left table row.
Explain how a LEFT JOIN works and why some columns might show NULL values in the result.
Think about what happens when the right table has no matching data.
You got /3 concepts.
Describe how to find rows in the left table that have no matching rows in the right table using a LEFT JOIN.
Filtering NULLs in right table columns helps find unmatched rows.
You got /3 concepts.
Practice
(1/5)
1. What does a LEFT JOIN do in SQL?
easy
A. Returns all rows from the left table and matched rows from the right table, NULL if no match.
B. Returns only rows that have matching values in both tables.
C. Returns all rows from the right table and matched rows from the left table.
D. Deletes rows from the left table that have no match in the right table.
Solution
Step 1: Understand LEFT JOIN behavior
A LEFT JOIN keeps all rows from the left table regardless of matches in the right table.
Step 2: Identify NULLs for unmatched rows
If there is no matching row in the right table, the result shows NULL for right table columns.
Final Answer:
Returns all rows from the left table and matched rows from the right table, NULL if no match. -> Option A
Quick Check:
LEFT JOIN = all left rows + NULL for no match [OK]
Hint: LEFT JOIN keeps all left rows, unmatched right rows show NULL [OK]
Common Mistakes:
Confusing LEFT JOIN with INNER JOIN
Thinking unmatched rows are dropped
Assuming NULLs appear in left table columns
2. Which of the following is the correct syntax for a LEFT JOIN in SQL?
easy
A. SELECT * FROM table1 LEFT OUTER JOIN table2 WHERE table1.id = table2.id;
B. SELECT * FROM table1 JOIN LEFT table2 ON table1.id = table2.id;
C. SELECT * FROM table1 LEFT JOIN table2 USING (id);
D. SELECT * FROM table1 LEFT JOIN table2 ON table1.id = table2.id;
Solution
Step 1: Review standard LEFT JOIN syntax
The correct syntax is: SELECT columns FROM left_table LEFT JOIN right_table ON condition.
Step 2: Check each option
SELECT * FROM table1 LEFT JOIN table2 ON table1.id = table2.id; matches the correct syntax exactly. SELECT * FROM table1 JOIN LEFT table2 ON table1.id = table2.id; has JOIN LEFT which is invalid. SELECT * FROM table1 LEFT OUTER JOIN table2 WHERE table1.id = table2.id; is invalid because JOIN requires an ON clause (syntax error). SELECT * FROM table1 LEFT JOIN table2 USING (id); is correct syntax with parentheses.
Final Answer:
SELECT * FROM table1 LEFT JOIN table2 ON table1.id = table2.id; -> Option D
Quick Check:
LEFT JOIN syntax = LEFT JOIN ... ON ... [OK]
Hint: Use LEFT JOIN ... ON ... for correct syntax [OK]
Common Mistakes:
Swapping JOIN and LEFT keywords
Using WHERE instead of ON for join condition
Omitting parentheses in USING clause
3. Given tables Employees and Departments with data:
Employees: id | name | dept_id 1 | Alice | 10 2 | Bob | 20 3 | Carol | NULL