Problem Description
Write a SQL query to report all customers who never placed any order. ### Example **Customers Table:** | id | name | | :--- | :--- | | 1 | Joe | | 2 | Henry | | 3 | Sam | | 4 | Max | **Orders Table:** | id | customerId | | :--- | :--- | | 1 | 3 | | 2 | 1 | **Expected Output:** | Customers | | :--- | | Henry | | Max |
Database Schema
undefined
Sample SQL Solution
-- Write your SQL query to find customers who never order
SELECT name AS Customers
FROM Customers c
LEFT JOIN Orders o ON c.id = o.customerId
WHERE o.id IS NULL;