Skip to main content

Modelling for SQLs

Data modelling in SQL is the design of tables, keys and relationships so data is stored once and stays consistent. Primary and foreign keys define links, constraints enforce rules, and normalisation, up to third normal form, removes redundancy that causes update anomalies. A good model makes queries simpler and prevents bad data.

Stage: Multiple Tables · Part of the SQL roadmap · Last reviewed 19 November 2026

What to learn in Modelling

Modelling interview questions

What is the difference between a primary key and a unique key?

A primary key uniquely identifies each row, cannot be NULL and a table has only one. A unique constraint also prevents duplicates, but a table can have several, and most databases allow NULL in them. Foreign keys normally reference the primary key.

What are update anomalies, and how does normalisation fix them?

When the same fact is stored in many rows, changing it in only some rows leaves inconsistent data, an update anomaly. Insert and delete anomalies are similar. Normalisation splits data into tables so each fact lives in one place, referenced by keys.

Where Modelling fits in the SQL roadmap

Modelling belongs to the Multiple Tables stage (beginner level), which takes about 18 hours. Relate data across tables.

Back to the full SQL roadmap