LEFT JOIN · NULL
Find customers who have never ordered
Which customers have yet to place an order?
Compare with the solution
Isla del Eco and Taller Horizonte appear in the results because the starting table contains all seven customers.
SELECT c.id AS cliente_id,
c.nombre
FROM clientes AS c
LEFT JOIN pedidos AS p ON p.cliente_id = c.id
WHERE p.id IS NULL
ORDER BY c.id ASC;| cliente_id | nombre |
|---|---|
| 6 | Isla del Eco |
| 7 | Taller Horizonte |