Covers the purpose of normalisation, the three data anomalies it removes, and 1NF, 2NF and 3NF applied step by step to an orders table in SQL Server.
Normalisation is organising tables so that each fact is stored once, in the table whose key it depends on, so the data cannot contradict itself. Redundant copies cause anomalies: an update anomaly (change a customer's email in one row but not the other 40), an insert anomaly (cannot record a product until someone orders it) and a delete anomaly (deleting the last order loses the customer).
A price on an order line is not a copy: it is the price charged on that day, a different fact from today's list price. For OLTP I design to 3NF and only denormalise where a measured read cost justifies the extra write and consistency cost.
"Normalisation is the discipline of putting every fact in exactly one place: the table whose key that fact depends on. The reason it matters is that duplicated facts drift. If a customer's email is copied onto every order row, an update that misses one row leaves the database disagreeing with itself. That's the update anomaly. The insert anomaly is when you can't record something, like a new product, without inventing an order for it. The delete anomaly is when removing one thing, like the last order, silently removes another, like the only record of the customer.
The normal forms are a checklist for removing those problems. First normal form says every column holds one atomic value and there are no repeating groups like Product1, Product2, Product3, and every row has a key. Second normal form applies when the key is composite: every non-key column must depend on the whole key. On an order-lines table keyed by OrderId and ProductId, ProductName depends only on ProductId, so it moves to Products. Third normal form removes transitive dependencies: on Orders, CustomerEmail depends on CustomerId, not on OrderId, so it moves to Customers.
The mistake I see is treating every copy as redundancy. The unit price on an order line is not a copy of the product's current price; it's a historical fact about that sale, so it belongs on the line. In a .NET service with EF Core I design the OLTP schema to third normal form by default, let foreign keys and unique constraints enforce it, and only denormalise once I've measured a read that genuinely needs it. Normalise for correctness first; denormalise for performance on evidence."
| Anomaly | Example in a flat OrdersFlat table |
Root cause |
|---|---|---|
| Update | Customer changes email; 3 of 40 rows keep the old one | Same fact stored many times |
| Insert | Cannot add a new product until it is ordered | Product facts live only on order rows |
| Delete | Cancelling the only order deletes the customer's address | Two facts share one row |
| Form | Rule | Violation in the orders example | Fix |
|---|---|---|---|
| 1NF | Atomic values, no repeating groups, has a key | Products = 'Kettle,Toaster' or Product1..Product3 columns |
One row per order line |
| 2NF | No partial dependency on a composite key | OrderLines(OrderId, ProductId, ProductName) |
Move ProductName to Products |
| 3NF | No transitive dependency | Orders(OrderId, CustomerId, CustomerEmail) |
Move CustomerEmail to Customers |
Start: OrdersFlat(OrderId, OrderDate, CustomerName, CustomerEmail, Products) where Products holds a comma-separated list.
OrderLines(OrderId, ProductId, ProductName, Quantity, UnitPrice).ProductName depends only on ProductId → Products(ProductId, Name, ListPrice).CustomerEmail depends on CustomerId → Customers(CustomerId, Name, Email); Orders(OrderId, CustomerId, OrderDate).| Workload | Target | Why |
|---|---|---|
| OLTP (orders, bookings) | 3NF / BCNF | Many small writes; correctness matters most |
| Reporting / analytics | Star schema (deliberately denormalised) | Few writes, many large reads |
| Caches, read models | Denormalised copies | Rebuilt from the normalised source |
On an order system [where you worked], a flat order table copied the customer's delivery address onto every order. A support fix updated the address on the latest order only, and [N] parcels went to the old address in a month. Moving addresses to their own table with an AddressId on the order (plus a snapshot on dispatch) removed the class of bug, and the table shrank by about [30]%.
Checks that the candidate understands why normalisation exists (anomalies) and can apply the normal forms to a concrete schema rather than recite definitions.
Green flags
Red flags
All the normal forms are defined by functional dependencies: A → B means "if I know A, I know exactly one B". CustomerId → CustomerEmail, ProductId → ProductName, (OrderId, ProductId) → Quantity. Normalising is just making sure every dependency points from a key of the table it lives in.
OrdersFlat
OrderId ───────────► OrderDate, CustomerId
CustomerId ────────► CustomerName, CustomerEmail (transitive: breaks 3NF)
(OrderId,ProductId)► Quantity, UnitPrice
ProductId ─────────► ProductName (partial: breaks 2NF)
1NF asks for: each column holds a single value of its type, no repeating groups (Phone1, Phone2, Phone3), and a key so rows are distinguishable. A comma-separated list in a column breaks 1NF: you cannot index an element, enforce a foreign key on it, or update one element without rewriting the string. SQL Server's STRING_SPLIT exists for parsing input, not as a storage design.
2NF only matters for composite keys. If the key is (OrderId, ProductId) and ProductName depends only on ProductId, every order line repeats the name. Tables with a single-column surrogate key are automatically in 2NF, which is why surrogate keys sometimes hide a design problem rather than fix it: OrderLines(OrderLineId, OrderId, ProductId, ProductName) is in 2NF technically but still has the redundancy, now as a transitive dependency via ProductId.
3NF: no non-key column depends on another non-key column. The classic memory aid is "every non-key attribute depends on the key, the whole key, and nothing but the key". Orders.CustomerEmail depends on Orders.CustomerId, a non-key column, so it moves.
OrderLines.UnitPrice looks like a copy of Products.ListPrice, but they are different facts: one is "the price charged on 3 March", the other is "today's price". The dependency is (OrderId, ProductId) → UnitPrice, which is a key dependency. The same goes for a delivery address captured at dispatch, or a tax rate applied to an invoice. Getting this wrong (joining to the current price for an old invoice) is a real bug that legal and finance teams notice.
Customers ◄──FK── Orders ◄──FK── OrderLines ──FK──► Products
PK CustomerId PK OrderId PK (OrderId, LineNo) PK ProductId
UQ Email UQ (OrderId, ProductId)
Primary keys, unique constraints and foreign keys turn the design into rules the engine enforces for every writer: your .NET API, a Python script, a support engineer in SSMS.
More tables mean more joins. Joins on indexed keys are cheap in SQL Server (a nested loop join with an index seek is a few logical reads per row), so for OLTP this is rarely the bottleneck. Reporting queries over millions of rows are where denormalisation (a star schema, an indexed view, a columnstore reporting table) starts to pay.
OrdersFlat with a comma-separated Products column, insert 5 rows, then try to write a query for "how many kettles did we sell?". Note how fragile it is.Customers, Products, Orders and OrderLines with primary and foreign keys.SaveChanges produces for one order with three lines.A flat table with anomalies, then the same data in 3NF.
-- Before: one wide table. Breaks 1NF (list in a column), 2NF and 3NF.
CREATE TABLE dbo.OrdersFlat
(
OrderId int NOT NULL PRIMARY KEY,
OrderDate date NOT NULL,
CustomerName nvarchar(100) NOT NULL,
CustomerEmail nvarchar(256) NOT NULL, -- repeated on every order: update anomaly
Products nvarchar(400) NOT NULL -- 'Kettle,Toaster': not atomic
);
-- After: 3NF. Each fact lives with the key it depends on.
CREATE TABLE dbo.Customers
(
CustomerId int IDENTITY PRIMARY KEY,
Name nvarchar(100) NOT NULL,
Email nvarchar(256) NOT NULL CONSTRAINT UQ_Customers_Email UNIQUE
);
CREATE TABLE dbo.Products
(
ProductId int IDENTITY PRIMARY KEY,
Name nvarchar(100) NOT NULL,
ListPrice decimal(19,4) NOT NULL
);
CREATE TABLE dbo.Orders
(
OrderId int IDENTITY PRIMARY KEY,
CustomerId int NOT NULL REFERENCES dbo.Customers (CustomerId),
OrderDate date NOT NULL
);
CREATE TABLE dbo.OrderLines
(
OrderId int NOT NULL REFERENCES dbo.Orders (OrderId),
ProductId int NOT NULL REFERENCES dbo.Products (ProductId),
Quantity int NOT NULL CHECK (Quantity > 0),
UnitPrice decimal(19,4) NOT NULL, -- the price charged then: a snapshot, not redundancy
CONSTRAINT PK_OrderLines PRIMARY KEY (OrderId, ProductId)
);
The same model in EF Core, so the database, not just the code, holds the rules.
namespace Shop.Data;
public sealed class Customer
{
public int CustomerId { get; set; }
public required string Name { get; set; }
public required string Email { get; set; }
public List<Order> Orders { get; } = [];
}
public sealed class Order
{
public int OrderId { get; set; }
public int CustomerId { get; set; }
public DateOnly OrderDate { get; set; }
public List<OrderLine> Lines { get; } = [];
}
public sealed class OrderLine
{
public int OrderId { get; set; }
public int ProductId { get; set; }
public int Quantity { get; set; }
public decimal UnitPrice { get; set; } // copied from Product.ListPrice at checkout on purpose
}
OrderLines.UnitPrice as redundancy and joining to the current product price. Why it is wrong: historical invoices change when prices change. Instead: store the price charged as a snapshot on the line.Id column makes a table normalised. Why it is wrong: it satisfies 2NF trivially but transitive dependencies remain. Instead: list the functional dependencies and check 3NF.Phone1, Phone2, Phone3. Why it is wrong: a repeating group; the fourth phone needs a schema change and queries must check every column. Instead: a CustomerPhones table.Normalisation is about correctness under change: it decides how many places a single update has to touch. A senior answer frames the normal forms as a tool for finding redundant facts, distinguishes snapshots from copies, and knows that a star schema in a reporting database is a deliberate, read-optimised exception, not a failure to normalise.
I also measure rather than assume: before denormalising, I capture the slow query's actual plan, logical reads (SET STATISTICS IO, TIME ON) and its Query Store history, and try an index first. Only if the join itself is the cost do I add a copy, and then I decide who keeps it in sync (a computed column, an indexed view, or an event-driven read model) and how drift is detected.
| Option | When it fits | Cost | When not to |
|---|---|---|---|
| 3NF / BCNF | OLTP: orders, bookings, accounts | More joins; more tables to map | Large analytical scans |
| Star schema | Reporting, Power BI, data warehouse | Duplicated dimension data, ETL to keep in sync | Transactional writes |
| Snapshot columns | Facts that must not change later (price, address at dispatch) | Extra storage | Data that should follow the master record |
BCNF tightens 3NF: every determinant must be a candidate key. It only bites when a table has overlapping composite candidate keys, e.g. a tutoring table where each tutor teaches one subject. 4NF removes independent multi-valued facts stored together: an employee's skills and languages in one table force a cross product of rows. 5NF removes join dependencies: a table that can be split into three and rejoined without loss, because of a cyclic rule like "if a supplier supplies a part, and a project uses that part, and the supplier works with the project, then the supplier supplies that part to that project".
In practice, a sensible 3NF design with one table per independent relationship is almost always already in BCNF and 4NF; 5NF cases are rare. The value is spotting the smell, not chasing the label.
I denormalise only when a measured read cost cannot be fixed with an index or query rewrite, and only with a named owner that keeps the copy consistent. SQL Server gives three levels:
LineTotal = Quantity * UnitPrice), always consistent and indexable.The trade-off: reads get cheaper, but writes get slower and lock more, data flows get more complex, and every copy needs reconciliation.
Last updated 23 Nov 2026.