Learn Data Modeling with Phoebe

Design the schema everything else queries

A leader track on why the schema decides every argument your team is having about numbers - grain, ownership, naming, and what a bad model actually costs - with no code to write. And a builder track that designs a real ecommerce marketplace from scratch: entities, normalization, keys, DDL, six dimensions, three fact tables, four marts, and a semantic layer an AI analyst can query accurately. Every builder page runs real SQLite in your browser, and every session ships code you keep: the DDL, the transform, the marts, the validator, the golden question set.

16sessions
2tracks
8sql files you keep
20golden questions graded
27validation checks passing

The leader track 🀝 · for C-level, heads of data & curious minds · 6 x 45 min · no code to write

Thinking mode: why every disagreement about a number is really a disagreement about grain, what a bad model costs in rework and lost trust, how to make one metric mean one thing, what to buy versus standardise, who owns a table, and why an AI analyst is only as good as the model beneath it. Each session ends with the questions to ask your data team.

The builder track πŸ› οΈ Β· for practitioners Β· 10 sessions x 45 min (b10: 60) Β· live SQLite in your browser

One running project: Bazaar, a multi-merchant ecommerce marketplace. You design its transactional schema from a flat export (b1-b4), find out why analysts cannot query it (b5), build six dimensions and three fact tables they can query (b6-b7), answer four real business questions with the result (b8), publish it so an AI agent gets the right answer (b9), and extend the whole thing to returns and refunds in the capstone (b10). Every page runs real SQLite compiled to WebAssembly - editable, offline after one 660 KB load - and every session ships files into sql/, python/ and semantic/.

πŸ—‚οΈ Builder 1 Β· easy

Bazaar's source reality

From one flat export to eight entities. The conceptual / logical / physical ladder, and the first thing wrong with the spreadsheet everyone works from.

β–Ά Builders start here
πŸ§ͺ Builder 2 Β· easy

The anomaly lab

Four levers, one wide table, real UPDATE/INSERT/DELETE probes. Turn the anomalies off one by one and derive 3NF instead of memorising it.

β˜… signature lab
πŸ”— Builder 3 Β· medium

ER, cardinality and keys

Resolve the many-to-many, pick natural versus surrogate keys, and decide what a composite key is really saying about your grain.

ER diagram
βš™οΈ Builder 4 Β· medium

Physical OLTP

Types, NOT NULL, CHECK, foreign keys and the first indexes - then ship the DDL and generate 90 days of deterministic marketplace data.

ships sql/01 + generator
🧭 Builder 5 · medium

Why analysts cannot query OLTP

Write the business question against the source schema, feel the pain, then meet grain, conformance and the two-model split that fixes it.

grain worksheet
πŸ“ Builder 6 Β· hands-on

Dimension design

Six dimensions, surrogate keys, flat-and-wide over snowflaked, no NULLs ever, and slowly-changing type 2 where history actually matters.

ships sql/10
πŸ“Š Builder 7 Β· hands-on

Fact design

Three facts, three grains: what was sold, what was paid, what was wanted. Additivity, degenerate dimensions, and why you never join two facts.

ships sql/11 + 12
πŸ” Builder 8 Β· hands-on

Answering the four questions

Which merchant dropped, why sales fell, why one day collapsed, when the peak hours are - built as marts, and one hypothesis dies on the evidence.

ships sql/20 + 30
πŸ€– Builder 9 Β· hardest

Agent-ready modeling

Schema card, metric table, data contract, golden question set - then measure it: the same agent scores 0/20 without them and 20/20 with them.

β˜… signature lab
🏁 Builder 10 · hardest · 60 min

Capstone: returns and refunds

A brand-new subject area, all the way down the ladder - entities, keys, DDL, dimension, fact, mart, agent view - and 27 validation checks green.

whole ladder, alone
easy medium hands-on hardest

What you leave with - runnable, not slideware

sql/ 01_oltp_ddl.sql 02_seed.sql 10_dim_ddl.sql 11_fact_ddl.sql 12_oltp_to_star.sql 20_marts.sql 30_business_questions.sql 40_agent_views.sql
python/ gen_bazaar_data.py build_star.py validate_model.py answer_questions.py agent_text_to_sql.py agent_query_to_text.py eval_golden_questions.py
semantic/ schema_card.md contract.yaml golden_questions.jsonl

This is the prerequisite the deng bucket was missing: the schema that learn-sql-with-phoebe hands you to query is a schema somebody designed - this is where that work happens. Take it before learn-sql if you are starting fresh, or after it if you already write SQL and want to know why the tables look like that. Next along the ladder: learn-data-warehouse-with-phoebe operates the star you design here, and learn-data-engineering-with-phoebe builds the pipelines that fill it.

Built from Kimball & Ross (The Data Warehouse Toolkit), Inmon, relational-theory fundamentals, the dbt layering and model-contract conventions, and published text-to-SQL benchmark practice - every source named on the session that uses it, with an honest out-of-scope list.

Choose your path πŸ—ΊοΈ

Two doors, one marketplace. Leaders never write code; builders never sit through theory they have not just run themselves.

🀝 The leader path (judge & fund) a1β†’ a2β†’ a3β†’ a4β†’ a5β†’ a6
πŸ› οΈ The builder path (design Bazaar's) b1β†’ b2β†’ b3β†’ b4β†’ b5β†’ b6β†’ b7β†’ b8β†’ b9β†’ b10
πŸš€ The full journey (lead AND build) a1-a6β†’ b1-b10
⚑ The two-hour tour (if you only have one evening) b2 anomaly labβ†’ b7 fact designβ†’ b9 agent lab

The knowledge map 🧠

Both tracks at a glance - hover a session to spotlight its concepts, click any node to jump in.

The whole course on one sheet πŸ“

Seven modules: both tracks, why two honest teams report two different numbers, the Bazaar source reality, the builder ladder from source to semantic layer, the star it builds, the four expensive failures that dimension rules exist to prevent, and the four questions that are the exam.

Download for print (2800px) Every word here is real selectable text, so it stays sharp however far you zoom.

learn data modeling
with phoebe

Design the schema everything else queries
16 SESSIONS Β· TWO TRACKS Β· ONE MARKETPLACE, BAZAAR Β· 12 MERCHANTS, 90 DAYS, SGD

SEC-01 Two tracks

LEADER TRACK / NO CODE

  1. a1Why the schema decides everything
  2. a2The cost of a bad model
  3. a3Grain, and one number one meaning
  4. a4The tooling landscape
  5. a5Naming standards and ownership
  6. a6Agent-ready data

BUILDER TRACK / REAL SQL

  1. b1Bazaar's source reality
  2. b2The anomaly lab
  3. b3ER, cardinality and keys
  4. b4Physical OLTP
  5. b5Why analysts cannot query OLTP
  6. b6Dimension design
  7. b7Fact design
  8. b8Answering the four questions
  9. b9Agent-ready modeling
  10. b10Capstone: returns and refunds
16sessions
6leader
10builder
12merchants

SEC-02 The disagreement

The most useful 45 minutes in the track

You will sit in a room where two competent teams present two different numbers for the same word, and you will be expected to decide which one is right. Almost every time, neither team is wrong and neither is lying. They are counting different rows.

Every disagreement about a number is really a disagreement about grain.
The two questions that resolve it in the room
1 what does ONE ROW of this table mean? 2 per what? per order, per line, per merchant?

A fact table is where the numbers live, so it is the table people fight about. Almost every fight traces back to the same missing artifact: nobody wrote down what one row means.

SEC-03 The source reality

One marketplace, used by every session, so nothing on this sheet is a toy example.
who
BazaarA multi-merchant marketplace. 12 merchants trading.
when
90 days2026-04-01 to 2026-06-29, so month boundaries and a full quarter both land inside it.
unit
SGDOne currency, so a wrong number is a modelling error rather than an FX artefact.
Why a real dataset matters here

Every number quoted in the course was produced by running its code against this data. A modelling course on invented rows cannot show you a failure that only appears at scale or at a boundary.

SEC-04 The builder ladder

1
source reality what the operational system actually records
b1
2
anomaly lab find what the data does when nobody is looking
b2
3
ER, cardinality, keys the relationships, stated precisely
b3
4
physical OLTP the schema the application writes to
b4
5
why analysts cannot query it the case for a second model
b5
6
dimension design six dimensions, four rules
b6
7
fact design three facts, each with its grain written first
b7
8
the four questions the exam the model has to pass
b8
9
agent-ready a semantic layer an AI analyst can query accurately
b9
10
returns and refunds the capstone, where grain gets hard
b10
What ships, and in what order
sql/10_dim_ddl.sql the six dimensions sql/11_fact_ddl.sql the three facts sql/12_oltp_to_star.sql the load that fills them

SEC-05 The star it builds

dimensions6

  • four rules govern all six
  • history that holds
  • stable join paths
  • no NULL attributes

facts3

  • one grain sentence each
  • written first,
  • not added later
  • as a comment

marts4

  • what the business asks
  • plus a semantic
  • layer an agent
  • can query
None of the four dimension rules is a style preference. Each exists because a specific, expensive failure happens without it.
How to read this against SEC-06

Each of the four dimension rules answers one of the four failures in the next module. The rules are not a house style; they are the shape those failures left behind.

SEC-06 Four expensive failures

History that rewrites itselfYesterday's report changes because an attribute was updated in place. Ask: can we still reproduce last quarter's number exactly?
A join count that grows with every questionEach new question needs one more hop, so nobody can answer anything quickly. Ask: how many joins does the common question take?
Today's rate against April's salesA dashboard applies the current commission rate to historical revenue. Ask: which version of this attribute was true then?
Quietly 4 percent shortA quarter of revenue reporting is wrong because one attribute was NULL. Ask: what happens to a row when this field is missing?
Where these are dealt with

Session b6 builds the six dimensions that prevent the first three. Session b7 writes the grain sentence that prevents the fourth from hiding. Session b10 takes the whole thing to returns and refunds, which is where grain stops being obvious.

These are the four reasons the dimension rules exist. They are not preferences, they are scar tissue.

SEC-07 The four questions

Why they are the exam

A model is not good because it is normalized, or star-shaped, or documented. It is good because the questions the business actually asks are cheap and unambiguous to answer with it.

1
ASK ITthe question as the business words it
2
ANSWER ITlive, against the star, in one query
3
WATCH ONE DIEa plausible hypothesis fails on the evidence
4
WATCH ONE SURVIVEand know why the model let you tell them apart
A rate without its denominator is not evidence. A model's real job is to make a hypothesis refutable.
learn data modeling with phoebe 6 dimensions Β· 3 facts Β· 4 marts Β· 1 grain sentence per table by Phoebe Fu