First-Order vs Repeat Revenue

medium
Unit 12 · Window Functions V0/3 to milestone

How much revenue comes from customers' first orders versus their repeat orders? Return one row with first_order_revenue, repeat_revenue and repeat_pct (repeat revenue as a percentage of all revenue, rounded to 1 decimal place).

A customer's first order is the earliest by order_date, with ties broken by the lower order id.

Schema

customers(id, name, country, signup_date)
orders(id, customer_id, order_date, total)
#window-functions#retention#aggregation1 visible + 2 hidden tests
query.sql · SQLite
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
First-Order vs Repeat Revenue · TechGradify