Module 4.1: Analytical SQL (Window Functions)
Compute across related rows without collapsing them: ranking, period-over-period offsets, and running-total frames.
Ranking: ROW_NUMBER, RANK, DENSE_RANK
Rank rows within a partition without collapsing them.
LAG and LEAD: Period-over-Period
Compare each row to its neighbor without a self-join.
Frames: Running Totals & Moving Averages
Aggregate over a sliding window of rows with a frame clause.
Module 4.2: Recursive CTEs
Walk self-referencing hierarchies (org charts, category trees) to produce depth and breadcrumb paths.
Module 4.3: Warehouse Modeling and History
Load a star schema and track change over time: surrogate keys, then SCD Type 1 overwrite and Type 2 history.
Building a Star Schema Load
Populate dimensions with surrogate keys, then load a fact that references them.
Slowly Changing Dimensions: Type 1
Overwrite a changed attribute in place with no history.
Slowly Changing Dimensions: Type 2
Preserve history by expiring old rows and inserting new versions.
Module 4.3b: Dimensional Modeling in Depth
Beyond the basic star: snowflake trade-offs, fact-table types and measure additivity, and the standard dimension patterns (conformed, role-playing, degenerate, junk).
Star vs Snowflake Schemas
Denormalize a wide star dimension into a snowflake sub-dimension, then pay the extra join to query it.
Fact Table Types and Measure Additivity
Classify fact tables by grain and use measure additivity to decide which sums are valid: correctly roll up a semi-additive balance and recompute a non-additive ratio from additive parts.
Dimension Patterns: Conformed, Role-Playing, Degenerate, Junk
Model conformed, role-playing, degenerate, and junk dimensions, plus factless facts, the way data-engineering interviewers ask about them.
Module 4.4: Pipeline Correctness
The habits that separate a junior script from a production loader: deduplication and idempotent upsert/merge.
Module 4.5: Quality, Performance, and Capstone
Guard and tune the pipeline: dbt-style data-quality assertions, EXPLAIN/indexes, and a capstone Type-2 SCD loader.
Data-Quality Assertions
Encode expectations as tests that fail before bad data spreads.
EXPLAIN and Query Performance
Read a query plan and turn a full scan into an index seek.
Capstone: A Type-2 SCD Loader
Combine dedup, SCD2, idempotency, quality, and perf into one production-grade loader.