Practice · medium · dataset: ecom
Customers above average order count
Find customers whose order count is above the average order count across all customers. Count customers with zero orders as zero when computing the average.
Return customer_id, email, and order_count. Sort by order_count descending, 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 average is over the customer population, not over customers who have ordered.
⌘/Ctrl + Enter to grade
Write a query, then grade it.
Hints
Try it first. Reveal a hint only when you are stuck.