0
0
SQLquery~5 mins

Finding unmatched rows with LEFT JOIN 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
beginner
How can you find rows in the left table that have no matching rows in the right table using LEFT JOIN?
Use a LEFT JOIN and then filter where the right table's key column is NULL. This shows unmatched rows from the left table.
Click to reveal answer
beginner
Why do we check for NULL in the right table's columns after a LEFT JOIN?
Because unmatched rows from the left table will have NULL values in the right table's columns, indicating no match was found.
Click to reveal answer
intermediate
Write a simple SQL query to find customers who have no orders using LEFT JOIN.
SELECT customers.* FROM customers LEFT JOIN orders ON customers.id = orders.customer_id WHERE orders.customer_id IS NULL;
Click to reveal answer
intermediate
What is the difference between LEFT JOIN and INNER JOIN when finding unmatched rows?
INNER JOIN returns only matching rows from both tables, so it excludes unmatched rows. LEFT JOIN returns all left table rows including unmatched ones.
Click to reveal answer
What does the condition 'WHERE right_table.id IS NULL' do after a LEFT JOIN?
AFinds rows in the left table with no match in the right table
BFinds rows in the right table only
CFinds rows with matching keys in both tables
DDeletes unmatched rows
Which JOIN type returns all rows from the left table regardless of matches?
ALEFT JOIN
BRIGHT JOIN
CFULL JOIN
DINNER JOIN
If you want to find unmatched rows in the right table, which JOIN would you use?
ALEFT JOIN
BRIGHT JOIN
CINNER JOIN
DCROSS JOIN
What happens to unmatched rows from the right table in a LEFT JOIN?
AThey are duplicated
BThey are included with NULLs in left table columns
CThey cause an error
DThey are excluded from the result
Which SQL clause is essential to filter unmatched rows after a LEFT JOIN?
AGROUP BY
BHAVING
CWHERE right_table.column IS NULL
DORDER BY
Explain how to find unmatched rows in one table using LEFT JOIN.
Think about what happens to unmatched rows in a LEFT JOIN result.
You got /3 concepts.
    Describe the difference between INNER JOIN and LEFT JOIN when looking for unmatched rows.
    Consider which join keeps unmatched rows from the left table.
    You got /3 concepts.