LEFT JOIN · NULL

Find customers who have never ordered

Which customers have yet to place an order?

SQLite
RESULTSReady to run
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_idnombre
6Isla del Eco
7Taller Horizonte