SQL & Data Modeling

Window functions, CTEs, query plans and the schema design questions that appear in ML interviews.

Module 02.4 · Beginner
Free

8h · 7 lessons · 1 challenge

About this module

Training data comes out of a warehouse, and the query that produces it is part of the model. This module covers SQL to the level ML engineers are actually tested at — window functions and CTEs, not SELECT star — plus enough schema design to discuss a feature table without hand-waving.

Includes reading a query plan, because "why is this slow" is the follow-up question.

After this module you can

7 lessons

Lesson 1
Joins, grain and the duplicate-row disaster
Kind
Concept
Length
50 min
Lesson 2
Window functions in depth
Kind
Concept
Length
55 min
Lesson 3
CTEs, subqueries and readable SQL
Kind
Concept
Length
40 min
Lesson 4
Point-in-time correctness for training sets
Kind
Concept
Length
55 min
Lesson 5
Query plans and why this one is slow
Kind
Lab
Length
70 min
Lesson 6
Query Quest: extract the training set
Kind
Interactive
Length
45 min
Lesson 7
Checkpoint: SQL under interview conditions
Kind
Checkpoint
Length
30 min

The challenge: Query Quest

Ten warehouse schemas, ten training sets to extract. Correctness first, then rows scanned — the leaderboard cares about both.

Worth 400 XP.

Related modules

All modules