MySQL SQL

MySQL LEFT JOIN

Keep every row from the left table.

SELECT p.name, c.name AS category
FROM products p
LEFT JOIN categories c ON c.id = p.category_id;

Products without a category remain, with NULL values for category columns.