Start here
The last two chapters gave you the grain sentence (what one row means) and the five shop tables. This chapter designs a fact table and solves the problems that come next.
A warehouse is a database built for reports. To load is to copy data into it.
We use the shop from the SQL chapters. This is its orders table:
| order_id | customer_id | status | amount | order_date |
|---|---|---|---|---|
| 101 | 1 | paid | 40.00 | 2026-01-03 |
| 102 | 1 | paid | 25.00 | 2026-01-10 |
| 103 | 2 | refunded | 60.00 | 2026-01-11 |
| 104 | 3 | paid | 15.50 | 2026-01-15 |
| 105 | 3 | pending | NULL | 2026-01-20 |
| 106 | 4 | paid | 80.00 | 2026-01-21 |
Money is in the amount column. Order 105 is pending, so its amount is empty.
Omar (customer 5) has no order. Dev has no country. Both matter later in this chapter.
Then this chapter solves eight problems that real fact tables meet. The recap table lists them.
What you will learn
- Use the four design steps on a new fact table.
- Add up measures correctly, and keep an amount at order level.
- Pick the right type of fact table.
- Store a refund. Handle an empty measure and an unknown country.
- Load a late fact. Store a fact with no number. Track an order journey.
