SQL Practice Logo

SQLPractice Online

Level 2 - JuniorDebugging Questions

Debugging: LEFT JOIN Filter Trap

Interviewer prompt: This query is supposed to keep all customers, but it drops customers without paid orders. Fix the query. SELECT c.id, c.name, o.id AS order_id FROM customers c LEFT JOIN orders o ON c.id = o.customer_id WHERE o.status = 'PAID';

Schema Context

customers(id, name), orders(id, customer_id, status)