easy · ~8 min
Retention tracks store loyalty with a single headline metric computed from orders: the repeat customer rate — the percentage of distinct customers who placed 2 or more orders out of all distinct customers who ordered.
orders
Write a query that returns a single summary row:
repeat_customers
total_customers
repeat_rate_pct
repeat_customers * 100.0 / total_customers
Input contract: order_id is unique and non-null; customer_id and amount are non-null. The orders table is non-empty, and a customer may place one or many orders.
order_id
customer_id
amount