Orders per Customer by Signup Cohort

medium
Unit 20 · Cohorts & Recursive CTEs0/1 to milestone

Do newer customers order as much as older ones? For each signup month (YYYY-MM from signup_date), return signup_month, customers (how many signed up) and orders_per_customer (their total number of orders divided by the number of customers, rounded to 2 decimal places). Customers with no orders count as zero. Sort by signup_month.

Schema

customers(id, name, country, signup_date)
orders(id, customer_id, order_date, total)
#cohorts#left-join#aggregation1 visible + 1 hidden tests
query.sql · SQLite
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Orders per Customer by Signup Cohort · TechGradify