Normal Forms

Normalization (and it’s inverse, renormalization) is one of the foundational concepts in relational database design. It’s a systematic process of organizing data to reduce redundancy, eliminate anomalies, and ensure data integrity. Understanding normal forms is essential for any database professional, even if you don’t always apply them strictly in practice. This post talks about some of its history:

The journey from unnormalized data to sixth normal form is a progression of increasingly stringent rules, each solving specific types of data problems. Let’s explore each normal form with practical examples.

The Beginning: Unnormalized Data

Before we discuss normal forms, let’s see what unnormalized data looks like. Imagine a simple spreadsheet tracking customer orders:

This structure has multiple problems: repeating customer information, multiple values in single cells, and difficulty querying or updating data. Normalization fixes these issues systematically.

order_idcustomer_namecustomer_emailitemstotal
1001John Doejohn@email.comWidget A, Gadget B, Doohickey C150.00
1002Jane Smithjane@email.comWidget A, Widget B75.00
1003John Doejohn@email.comGadget B50.00

First Normal Form (1NF)

Rule: Eliminate repeating groups and ensure each cell contains only atomic (indivisible) values.

First normal form requires that each column contain only one value, not lists or arrays. Every row must be unique, and there should be a primary key.

Converting our example to 1NF:

order_idcustomer_namecustomer_emailitemtotal
1001John Doejohn@email.comWidget A150.00
1001John Doejohn@email.comGadget B150.00
1001John Doejohn@email.comDoohickey C150.00
1002Jane Smithjane@email.comWidget A75.00
1002Jane Smithjane@email.comWidget B75.00
1003John Doejohn@email.comGadget B50.00

Second Normal Form (2NF)

Rule: Must be in 1NF, and all non-key attributes must depend on the entire primary key, not just part of it.

2NF addresses partial dependencies. If a table has a composite key, non-key attributes shouldn’t depend on only part of that key.

Converting our example to 2NF:

order_idcustomer_idtotal
1001501150.00
100250275.00
100350150.00
Order Table
customer_idcustomer_namecustomer_email
501John Doejohn@email.com
502Jane Smithjane@email.com
Customer Table
order_iditemquantity
1001Widget A1
1001Gadget B1
1001Doohickey C1
1002Widget A1
1002Widget B1
1003Gadget B1
Order Item Table

Third Normal Form (3NF)

Rule: Must be in 2NF, and no non-key attribute should depend on another non-key attribute (eliminate transitive dependencies).

3NF removes transitive dependencies where a non-key field depends on another non-key field rather than directly on the primary key.

order_idcustomer_idorder_datetotal
10015012024-10-15150.00
10025022024-10-1675.00
10035012024-10-1750.00
Order Table
customer_idcustomer_namecustomer_emailzip_code
501John Doejohn@email.com94103
502Jane Smithjane@email.com10001
Customer Table
zip_codecitystate
94103San FranciscoCA
10001New YorkNY
Zip Code Table
order_idproduct_idquantityline_total
1001201150.00
1001202160.00
1001203140.00
1002201150.00
1002204125.00
1003202160.00
Order Item Table
product_idproduct_nameprice
201Widget A50.00
202Gadget B60.00
203Doohickey C40.00
204Widget B25.00
Product Table

Most databases aim for 3NF as it provides a good balance between normalization benefits and practical usability. The remaining normal forms address more specific and less common scenarios.

Boyce-Codd Normal Form (BCNF)

Rule: Must be in 3NF, and every determinant must be a candidate key.

BCNF is a stricter version of 3NF that handles certain edge cases involving overlapping candidate keys. It’s sometimes called 3.5NF. Every determinant (left side of a functional dependency) is now a candidate key. Removed the anomaly where an instructor could be in multiple departments.

course_idinstructordepartment
CS101Dr. SmithComp Sci
CS102Dr. JonesComp Sci
CS101Dr. BrownComp Sci
MATH201Dr. SmithMathematics

The problem in that instructor is to department, but instructor is not a candidate key. To fix this we introduce BCNF.

course_idinstructor
CS101Dr. Smith
CS102Dr. Jones
CS101Dr. Brown
MATH201Dr. Smith
Course Intructor Table
instructordepartment
Dr. SmithComp Sci
Dr. JonesComp Sci
Dr. BrownComp Sci
Instructor Table

BCNF violations are less common than 3NF violations, and many databases that claim to be in 3NF are actually in BCNF.

Fourth Normal Form (4NF)

Rule: Must be in BCNF, and cannot have multi-valued dependencies that aren’t functional dependencies.

4NF addresses situations where a table contains two or more independent multi-valued facts about an entity.

employee_idskilllanguage
101JavaEnglish
101JavaSpanish
101PythonEnglish
101PythonSpanish
102SQLFrench

The problem is that we have a multi-valued dependency as skills and languages are independent of each other.

employee_idskill
101Java
101Python
102SQL
Employee Skill Table
employee_idlanguage
101English
101Spanish
102French
Employee Language Table

This eliminates the cartesian product effect where every combination of skill and language creates a row.

Fifth Normal Form (5NF)

Rule: Must be in 4NF, and every join dependency must be implied by candidate keys.

5NF, also called Projection-Join Normal Form (PJNF), addresses cases where information can be reconstructed from smaller pieces but storing it together creates anomalies.

supplierpartproject
AcmeWidgetProject A
AcmeGadgetProject A
AcmeWidgetProject B
GlobexWidgetProject A

The problem is a join dependency – this table can be reconstructed from smaller tables without loss of information

supplierpart
AcmeWidget
AcmeGadget
GlobexWidget
Supplier Part Table
partproject
WidgetProject A
WidgetProject B
GadgetProject A
Parts Project Table
supplierproject
AcmeProject A
AcmeProject B
GlobexProject A
Supplier Project Table

The original data can be reconstructed by joining these three tables. 5NF violations are rare and usually indicate complex business rules that might need rethinking.

Sixth Normal Form (6NF)

Rule: The table should only have a primary key and at most one other attribute.

6NF is the ultimate normalization, decomposing tables into irreducible components. It’s primarily theoretical and used in specific scenarios like temporal databases where you need to track when every single attribute changes independently.

employee_iddepartmentsalaryhire_date
101Engineering850002020-01-15
102Marketing720002019-06-20
103Sales680002021-03-10

The problem si that we cannot track changes to individual attributes over time (temporal data).

employee_iddepartmentvalid_fromvalid_to
101Engineering2020-01-152022-05-01
101Management2022-05-01NULL
102Marketing2019-06-20NULL
103Sales2021-03-10NULL
Employee Department Table
employee_idsalaryvalid_fromvalid_to
101850002020-01-152021-01-01
101920002021-01-012023-01-01
101980002023-01-01NULL
102720002019-06-202022-07-01
102780002022-07-01NULL
103680002021-03-10NULL
Employee Salary Table
employee_idhire_date
1012020-01-15
1022019-06-20
1032021-03-10
Employee Hire Date Table

Each attribute has its own temporal tracking. This is essentially what Anchor Modeling implements. 6NF is rarely used in practice except for specific temporal database requirements.

Practical Considerations

Understanding normal forms is crucial, but applying them requires judgment.

Transactional databases (OLTP) generally benefit from normalization through 3NF or BCNF. This reduces redundancy, prevents update anomalies, and maintains data integrity. The additional joins are acceptable because transactions typically affect small numbers of rows.

Analytical databases (OLAP) often deliberately denormalize for query performance. Star schemas intentionally violate 3NF by storing redundant data in dimension tables. The read-heavy workload and large-scale aggregations make denormalization worthwhile.

Most production databases aim for 3NF as the practical target. This eliminates most redundancy and anomalies without excessive complexity. BCNF is good if achievable without contortions. 4NF and beyond are special cases addressing specific situations rather than general design goals.

Common Pitfalls

Pursuing higher normal forms without considering query patterns can create overly complex schemas requiring too many joins. The theoretical purity doesn’t justify the practical pain.

Stopping at 1NF or 2NF leaves significant redundancy and update anomalies. The short-term convenience of fewer tables creates long-term maintenance headaches.

Normalization decisions should consider how the data will be used. A heavily queried reporting database might deliberately denormalize for performance, while a system-of-record database normalizes for integrity.

The Bottom Line

Normal forms provide a framework for thinking about data organization and dependencies. They’re not arbitrary rules but logical progressions addressing specific types of data problems.

For most applications, we aim for 3NF in transactional systems and deliberately denormalize in analytical systems where appropriate. Understanding all the normal forms gives you the knowledge to make informed tradeoffs rather than blindly following rules.

The goal isn’t achieving the highest normal form possible, it’s designing databases that serve their intended purpose effectively. Sometimes that means aggressive normalization. Sometimes it means strategic denormalization. The normal forms give you the vocabulary and concepts to make these decisions intelligently.

To understand how this approach differs in denormalize in analytical systems, please read.

Discover more from Data Lingua. Where Data Engineering Meets Agentic Business Strategy

Subscribe now to keep reading and get access to the full archive.

Continue reading