Churn, Aug 1, 2025: 45 days without orders, delivered
Instructions
Consider only delivered orders (status = 'delivered'), by the date created_at. The reporting date is August 1, 2025; orders from this date onward are not counted. An active customer is a customer with at least one such order strictly before August 1, 2025. An active customer is considered churned if they have no such orders from June 17, 2025 to July 31, 2025 inclusive (the 45 days before the reporting date). For each customer city (customers.city), output city, active_customers (the number of active customers), churned (the number of churned customers) and churn_pct (churned / active_customers × 100, rounded to 1 decimal place). Sort by city.
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
deliveries.→restaurant_id restaurants.id - N:1Many-to-one
deliveries.→customer_id customers.id - N:1Many-to-one
deliveries.→courier_id couriers.id
Table data
Select a table in the diagram or list to view its rows.