Practice · medium · dataset: ecom
Customer order counts including zero
The CRM team wants every customer with their total number of orders, including customers who have
never ordered. Return customer_id, email, and order_count, where order_count is 0 for
customers with no orders.
Sort by order_count ascending, then by customer_id ascending.
Tables available
| Table | Columns |
|---|---|
customers |
customer_id, email, country, signup_date |
orders |
order_id, customer_id, order_date, status, channel |
The output must contain one row per customer, not one row per order.
⌘/Ctrl + Enter to grade
Write a query, then grade it.
Hints
Try it first. Reveal a hint only when you are stuck.