Full answer
Fact table: one row per event at a chosen grain, such as "one row per order line". It holds foreign keys to dimensions and numeric measures.
Dimension tables: descriptive attributes, often flattened. A product dimension might carry category and brand directly instead of separate tables, so a report needs one join per dimension, not a chain.
A date dimension (one row per day with year, quarter, week, holiday flag) makes calendar grouping a simple join and keeps business definitions such as fiscal quarters in one place.
The design steps commonly taught:
- Choose the business process.
- Declare the grain.
- Pick dimensions.
- Pick facts (measures).
Getting the grain wrong is the classic mistake. Mixing order-level and line-level facts in one table double-counts order shipping fees.
Key points
- Fact tables hold events and measures at a declared grain
- Dimension tables hold descriptive, often denormalized attributes
- A date dimension simplifies calendar logic
- OLTP favours normalized writes; star schemas favour reads
Common mistakes
- Mixing grains in one fact table
- Snowflaking dimensions without need and adding joins
Follow-ups
- What is a slowly changing dimension?
- How would you model shipping fees charged per order?
Tips
- Declare the grain first