#976

Guest Orders Hide New Users

Marketing is looking for users who have never ordered. orders.user_id contains empty values for guest orders, and the old check breaks the list because of them. Fix it and return the id values for users without orders, sorted by id.

Buggy query
SELECT u.id
FROM users u
WHERE u.id NOT IN (SELECT user_id FROM orders)
ORDER BY u.id;

Esempio di output atteso

Ecco come appare una risposta corretta — il suo numero di righe è a sé stante, non deve corrispondere alle tabelle dello schema.

id
5

Il risultato della tua query apparirà qui