Aligning to Week-Start and Month-End
Concepts covered: sqlRecursiveCte
A date spine is a complete enumeration of dates over a window, used to LEFT JOIN actuals onto so missing dates appear as explicit zero rows. Every period-over-period query, every retention curve, every monitoring metric uses a date spine. The question is which tool to use: generate_series (Postgres-specific, simplest), a recursive CTE (portable across engines), or a calendar table (production-grade). Each has a cost and a use case. generate_series for Postgres-style spines Postgres's generate_series is the cleanest way to produce a date spine when you can use it. It takes a start, an end, and an interval; it returns one row per step. Snowflake and BigQuery have similar functions (GENERATOR, GENERATE_DATE_ARRAY) with different signatures. The pattern is engine-specific; the candidate names
About This Interactive Section
This section is part of the Date Arithmetic: Intermediate lesson on DataDriven, a free data engineering interview prep platform. Each section includes explanations, worked examples, and hands-on code challenges that execute in real time. SQL queries run against a live database. Python runs in a sandboxed Docker container. Data modeling problems validate against interactive schema canvases. All content is framed around what data engineering interviewers actually test at companies like Meta, Google, Amazon, Netflix, Stripe, and Databricks.
How DataDriven Lessons Work
DataDriven combines four interview rounds (SQL, Python, Data Modeling, Pipeline Architecture) with adaptive difficulty and spaced repetition. Easy problems get harder as you improve. Weak concepts resurface until you master them. Your readiness score tracks progress across every topic interviewers test. Every lesson section ends with problems you solve by writing and running real code, not by picking multiple-choice answers.