MySQL SQL

MySQL INNER JOIN

Return rows that match in both tables.

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

Rows without a matching category are excluded.