PostgreSQL

PostgreSQL RIGHT JOIN

Keep every row from the right table and matching rows from the left table.

Use RIGHT JOIN

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

Categories without products are still returned. In practice, reversing the table order and using LEFT JOIN is often easier to read.