DEV Community

Nidheesh Thangavel
Nidheesh Thangavel

Posted on

Database Normalization: From 1NF to 3NF







 đź§  Database Normalization: From 1NF to 3NF Explained Simply

If you’ve ever worked with relational databases, you know how quickly things can get messy when data isn’t properly organized. That’s where normalization comes in — a systematic way of structuring data to minimize redundancy and maintain integrity.

In this post, we’ll walk through the process of normalization from First Normal Form (1NF) to Third Normal Form (3NF) with simple explanations and examples.

🔍 What Is Database Normalization?

Normalization is the process of organizing database columns (attributes) and tables (relations) to ensure data consistency and reduce duplication.

The main goals are:

Avoid storing the same data more than once

Make data easier to update, insert, and delete

Ensure logical data relationships

đźš« The Problem: An Unnormalized Table

Imagine a table storing student information, courses, and instructors like this:

Looks fine at first — but this design leads to serious anomalies:

Insertion anomaly: Can’t add a new student unless they’re taking a course

Update anomaly: Changing an instructor’s phone number requires multiple edits

Deletion anomaly: Removing a student’s last course deletes their entire record

âś… First Normal Form (1NF): Atomic Data

To achieve 1NF, we ensure that:

Each cell contains a single value (no lists or multiple values).

Each record is unique.

So, we split repeating data into multiple rows. Every column now holds atomic values — indivisible pieces of information.

đź§© Second Normal Form (2NF): Remove Partial Dependencies

1NF removes repeating groups, but partial dependency can still exist when a column depends on part of a composite primary key.

To fix this:

Create separate tables for Students, Courses, and Instructors.

Ensure that every non-key attribute depends on the whole key, not part of it.

Now, our relationships are more structured and clear.

🔄 Third Normal Form (3NF): Remove Transitive Dependencies

In 3NF, we eliminate transitive dependencies — when a non-key column depends on another non-key column.

For instance, InstructorPhone depends on Instructor, not on Course.
So, we move instructor details into a separate table.

🏗️ Final Normalized Structure

After normalization up to 3NF, our tables look like this:

Students
| StudentID | StudentName |

Instructors
| InstructorID | InstructorName | InstructorPhone |

Courses
| CourseID | CourseName | InstructorID |

StudentCourses
| StudentID | CourseID |

This design:

Eliminates redundancy

Prevents update anomalies

Makes queries and maintenance cleaner and faster

đź§ľ Summary
Normal Form Goal Key Action
1NF Atomic data Remove repeating groups
2NF Full functional dependency Remove partial dependencies
3NF Transitive dependency removal Separate related data into new tables
THE INPUT AND OUTPUT SCHREENSHOTS:






Top comments (0)