The months nobody shopped

The store opened in January 2022, and the owner wants the full timeline from 2022-01 to 2024-03 — every month, even the ones with zero sales. Generate the month list with WITH RECURSIVE (each step adds one month), then LEFT JOIN the real monthly revenue, showing COALESCE(..., 0) for the empty months. 27 rows in total — the 20 zeros are the dry spells.

Tables in this exercise
invoices
id customer_id invoice_date billing_city billing_country total

Back to the chapter