Repeat in 60 days: Feb–May 2025, paid+shipped
Instructions
Consider only paid and shipped orders (status 'paid' or 'shipped'). A customer's first order is their earliest such order over the whole history (by created_at); the cohort is the month of the first order (cohort_month is the first day of the month). Take customers whose first order was placed from February 1, 2025 to May 31, 2025 inclusive. A customer placed a repeat order within 60 days if they have another counted order strictly later than the first one and no later than 60 days after it (created_at <= first + interval '60 days'). For each cohort, output cohort_month, customers (the number of customers in the cohort), repeaters (the number of customers with a repeat order) and repeat_rate_pct (repeaters / customers × 100, rounded to 1 decimal place). Sort by cohort_month.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Table relationships
- N:1Many-to-one
order_items.→order_id orders.id - N:1Many-to-one
order_items.→product_id products.id - N:1Many-to-one
orders.→customer_id customers.id - N:1Many-to-one
products.→category_id categories.id
Table data
Select a table in the diagram or list to view its rows.