Practice · hard · dataset: ecom
Repeat-purchase rate by country
A growth team wants to compare repeat-purchase behaviour across markets. A customer counts as a repeater when they placed an order within 30 days of an earlier order.
Return country, customers (all customers in that country), repeaters (customers who qualify),
and repeat_rate_percent (repeaters divided by customers, as a percentage rounded to two decimals).
Sort by country ascending.
Tables available
| Table | Columns |
|---|---|
customers |
customer_id, email, country, signup_date |
orders |
order_id, customer_id, order_date, status, channel |
“Within 30 days” includes a gap of exactly 30 days. Customers with no orders or only one order stay in the denominator and are not repeaters.
⌘/Ctrl + Enter to grade
Write a query, then grade it.
Hints
Try it first. Reveal a hint only when you are stuck.