23/34
Part 5 of 6 · Empty daysLearn and do
Days and users with no rows need rows of their own
A window only sees rows that exist. Nothing happened from March 4 to March 8, so those days have no rows to count, to show, or to line up in a ROWS frame. When the question needs every day, or every user, build those rows first and join the data onto them.
A recursive CTE builds a calendar
SQLite builds a calendar with a recursive CTE. Here it builds the five empty days.
The recursive step adds a day while day < '2026-03-08', starting from March 4. How many rows come out?
Pick an answer above to see the rest