Mastering Database Normalization: First, Second, and Third Normal Forms Explained
This article explains the concepts, requirements, and practical examples of the first, second, and third normal forms in relational databases, showing how to identify repeated groups, handle composite keys, and eliminate transitive dependencies to achieve a well‑structured schema.
First Normal Form (1NF)
The first normal form eliminates repeated groups by requiring each column to contain atomic (indivisible) values; every field must hold a single value. It was introduced by Edgar F. Codd in 1971.
Repeated groups often appear in accounting ledgers where a record may have a variable number of values. For example, the "Quantity" column can contain multiple entries, violating 1NF. Converting each record into a single‑row representation removes the repeated group.
Contact information stored as a composite attribute violates 1NF because it cannot be separated into atomic fields.
Simple adjustments can transform the data into a standard two‑dimensional table.
The result is a conventional relational table that satisfies 1NF.
Second Normal Form (2NF)
Prerequisite: the table must already be in 1NF.
A standard two‑dimensional table meets the 1NF condition.
To satisfy 2NF, every non‑key attribute must depend on the entire primary key, not just part of it.
Consider the following blog table example:
Using a single user field as the primary key fails because one user can have multiple blog entries and multiple users can edit the same chapter title.
A composite primary key <user, chapter, title> still leaves the user_score attribute dependent only on user, thus violating 2NF.
Solution: split the dependent fields into separate tables.
If the primary key consists of a single column, the table automatically satisfies 2NF.
If the primary key is composite, each non‑key attribute must depend on the whole key.
Third Normal Form (3NF)
Rule: non‑key columns must not depend on each other (no transitive dependencies).
Using a course schedule table as an example:
The primary key is a single column, so the table meets 2NF, and most attributes depend on the PK. However, the instructor_title attribute depends on instructor_name, creating a transitive dependency that violates 3NF.
Extract fields that are not directly dependent on the primary key into separate tables.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
JavaEdge
First‑line development experience at multiple leading tech firms; now a software architect at a Shanghai state‑owned enterprise and founder of Programming Yanxuan. Nearly 300k followers online; expertise in distributed system design, AIGC application development, and quantitative finance investing.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
