DATA ARCHITECTURE

Normalization & Denormalization

Chapter 05FoundationsStructure

Orientation

What You'll Master Here

Normalization is not an exam ritual. It puts each independently changing fact in one authoritative place so writes cannot quietly contradict each other.

We use a continuous commerce dataset: customers, orders, order items, products, categories, and captured sale prices.

You will see why a wide order-line table breaks, how dependencies reveal the right tables, and when an owned read model earns deliberate duplication.

Why it matters

Duplicated facts eventually drift. A schema should protect truth instead of asking every writer to remember every copy.

Core mental model

One independently changeable fact, one source of truth. Denormalize only an owned read path with refresh and staleness rules.

Normalization ladder
formprotects againstcommerce example
1NFrepeating groupsone order item per row, not item_1/item_2 columns
2NFpartial dependencyproduct_name does not depend on only product_id in order_items
3NFtransitive dependencycategory_name does not depend through category_id
BCNFnon-key determinantevery determinant identifies a whole row
Key terms
functional dependency
X -> Y means X determines one Y in the modeled business domain.
determinant
The left side of a dependency, such as product_id in product_id -> product_name.
anomaly
A write failure caused by storing independent facts together.

Common mistake

Splitting tables mechanically without checking workload.

Unnecessary joins replace a clear source model.

Better habit

  • Write dependency arrows before moving columns.
  • Test update, insert, and delete scenarios.
  • Name the owner of every duplicated field.
What to say

I normalize independently changing facts, then denormalize only a measured read path with an explicit owner and refresh rule.

Practice prompts

  • List three independent facts in an order system.
  • Name the owner of customer_name in a reporting table.

Remember this

Normalization protects truth; denormalization serves proven reads.