FREE STUDY NOTES · DP-900

Database normalisation: primary keys, foreign keys and why it is used

How normalisation splits data into one table per entity, linked by keys, so each fact is stored once.

From Ultra Transcenders DP-900 by Tony Rough (publishing soon)

Normalisation is the schema design process that turns a flat, repetitive list into a set of related tables. A schema is simply the design of the tables, their columns and the links between them.

Normalisation minimises data duplication and enforces data integrity. Database professionals define it through a series of formal levels called normal forms, but for practical purposes it comes down to four rules:

  1. Separate each entity into its own table.
  2. Separate each discrete attribute into its own column.
  3. Uniquely identify each entity instance (row) with a primary key.
  4. Use foreign key columns to link related entities.

Consider a sales spreadsheet where every line repeats the customer’s name and full postal address and the product’s name and price, and where a single cell holds both the street and the city. Normalising it produces separate customer, product, order and line item tables, each attribute in its own column. Figure 3.1 shows the result, with primary and foreign keys linking the tables.

A wide sales list repeats the customer name, address (street and city in one cell), product and price on every line. Normalising it gives Customer, Order, Line item and Product tables, each with a primary key, and foreign keys in Order and Line item that point to the primary keys of the related tables.
Figure 3.1: Normalising a wide sales list into related tables

The benefits follow directly from the rules:

Characteristic Unnormalised list (one wide table) Normalised schema
Customer address stored Once per order line Once, in the customer row
Changing an address Edit every repeated copy Edit one row
Mixed values in one field Common (street and city together) Avoided: one attribute per column
Data type control Weak Each column has its own type
Linking related data Repetition Primary and foreign keys

Denormalisation for analytics

Normalisation suits transactional systems, where many small writes must keep data consistent. Analytical stores often take the opposite approach on purpose. In dimensional models used for data warehouses, denormalisation means storing precomputed, redundant data; dimension tables are almost always denormalised (a product dimension might hold the product, its subcategory and its category in one table) because the improved query performance and usability outweigh the cost of the extra storage. Data warehouse design is covered in Chapter 7, Large-scale analytics: ingestion, analytical stores, Microsoft Fabric and Azure Databricks.

Common trap: Believing normalisation exists mainly to make queries faster - Microsoft Learn defines it as a design process that minimises duplication and enforces integrity; analytical models frequently denormalise precisely to make queries faster and simpler.

Get the whole book

This note is one section of Ultra Transcenders DP-900: Microsoft Azure Data Fundamentals, an independent study guide that explains every topic the exam covers by technology, with comparison tables, diagrams and the common traps, plus a glossary linked to Microsoft Learn.

Amazon.co.ukKindle: coming soonPaperback: coming soon
Amazon.comKindle: coming soonPaperback: coming soon

Publishing soon on Amazon in Kindle and paperback editions.

About the book · DP-900 terms in the glossary · All DP-900 study notes

More DP-900 study notes