First Order Size vs Later Spend

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

Does a big first order predict more spending? Label each buying customer by their first order (by date, ties by id): 'big' if its total is at least 100, otherwise 'small'. Return first_order_type, customers and avg_total_spend (average total spend of those customers, rounded to 2 decimals). Sort by first_order_type.

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
query.sql · SQLite
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
First Order Size vs Later Spend · TechGradify