Daily orders including zero days

easySQL~15 min · 4 tests · bitshop

The dashboard team is plotting daily orders. GROUP BY order_date only returns days that had an order, so quiet days vanish and the line chart draws straight across them.

Return one row for every calendar day from the first order date to the last order date, inclusive:

column type meaning
day date the calendar day
orders integer orders placed that day, any status; 0 if none

Sort by day, oldest first. Order matters.

day must be a DATE, not a timestamp.

Tables: orders.

solution.sqlDuckDB · bitshop

Press ⌘ ↵ or Run to check the visible tests. Submit runs the hidden ones too. Everything runs in your browser.

⌘ ↵ to run