Compare INNER JOIN and LEFT JOIN
INNER JOIN returns matching pairs. LEFT JOIN also preserves rows from the left table that have no match, filling the right columns with NULL. Compare product rows when adding category shipping fees.
SELECT p.name, c.shipping_fee FROM products p LEFT JOIN categories c ON p.category = c.category_name;Common misunderstanding
A WHERE condition on a right-side column can remove unmatched rows again. Distinguish matching conditions from result filters.
Related missions
- Practice: Add shipping fees
- Practice: Keep products without fees
- Practice: Find missing shipping rules
Practice opens in this page’s language. Change it in the practice options at any time.