Monthly Revenue with a Date Spine

hard
Unit 24 · Window Functions & Cohorts0/0 to milestone

A plain GROUP BY month skips months with no orders, so charts silently draw a line straight across the gap. Build a date spine: every month from the first order's month to the last order's month, with revenue 0 for months with no orders.

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
Monthly Revenue with a Date Spine · TechGradify