# Data Modelling: Normalization and Star Schemas

> How tables are designed for applications versus analytics, including normal forms, facts, dimensions and slowly changing data. Free notes, key concepts,...

Canonical: https://www.internhack.in/roadmaps/tracks/data-analyst/data-modelling
Last updated: 2026-11-28

How tables are designed for applications versus analytics, including normal forms, facts, dimensions and slowly changing data.

Intermediate · about 5 hours · difficulty 3/5

Learn first: [Relational Databases with PostgreSQL](https://www.internhack.in/roadmaps/tracks/data-analyst/relational-databases)

Data modelling is deciding how data is split into tables. Understanding it helps you find the right table quickly, join correctly, and eventually design tables yourself.

### Normalization (application databases)

Normalization removes redundancy so each fact is stored once. In practice:

- **1NF**: atomic values, no repeating groups (no "tag1, tag2, tag3" in one cell).
- **2NF / 3NF**: every non-key column depends on the key, the whole key, and nothing but the key.

This keeps writes consistent, but answering questions requires many joins.

### Dimensional modelling (analytics)

Warehouses often use a **star schema**:

- **Fact tables** hold events or measurements at a defined grain: one row per order line, per page view, per daily account snapshot. They contain foreign keys and numeric measures.
- **Dimension tables** describe the who, what, where and when: customers, products, stores, dates. They are wide and denormalised for easy filtering.
- A **snowflake schema** normalises dimensions further; simpler stars are usually preferred for BI.

### Useful concepts

- **Grain** first: declare what one fact row means before anything else.
- **Surrogate keys** vs natural keys.
- **Slowly changing dimensions**: type 1 overwrites, type 2 keeps history with valid-from and valid-to dates, so last year's sales stay attributed to last year's region.
- **Wide flat tables** (one big denormalised table) are also common in modern warehouses and BI.

**Pitfall:** joining a fact to a type 2 dimension without a date condition, which multiplies rows. Move on when you can sketch a star schema for a business you know, naming the grain of each fact.

## Key concepts

- **Normal forms 1NF to 3NF**
- **Fact and dimension tables**
- **Star vs snowflake schema**
- **Declaring grain**
- **Surrogate and natural keys**
- **Slowly changing dimensions**
- **Wide denormalised tables**
- **Entity relationship diagrams**

## Mini project

Redesign the Chinook database (normalised) into a star schema with a sales fact at invoice-line grain plus customer, track and date dimensions, and write the SQL to build it.

## Check yourself

What is the grain of your fact table, and why must you decide it before choosing columns?

## Free resources

- [Star schema](https://en.wikipedia.org/wiki/Star_schema) (Wikipedia)
- [Database normalization](https://en.wikipedia.org/wiki/Database_normalization) (Wikipedia)
- [Kimball dimensional modeling techniques](https://www.kimballgroup.com/data-warehouse-business-intelligence-resources/kimball-techniques/dimensional-modeling-techniques/) (Kimball Group)

Previous: [Relational Databases with PostgreSQL](https://www.internhack.in/roadmaps/tracks/data-analyst/relational-databases) · Next: [Cloud Data Warehouses](https://www.internhack.in/roadmaps/tracks/data-analyst/cloud-warehouses)

## More in Databases, Warehouses and Data Modelling

- [Relational Databases with PostgreSQL](https://www.internhack.in/roadmaps/tracks/data-analyst/relational-databases)
- [Data Modelling: Normalization and Star Schemas](https://www.internhack.in/roadmaps/tracks/data-analyst/data-modelling)
- [Cloud Data Warehouses](https://www.internhack.in/roadmaps/tracks/data-analyst/cloud-warehouses)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Data Analyst Roadmap](https://www.internhack.in/roadmaps/tracks/data-analyst)
