DEV Community

Cover image for NORMALIZATION
srivishal
srivishal

Posted on

NORMALIZATION

Guide to Database Normalization (1NF → 3NF)
Normalization is the art of organizing data efficiently — avoiding redundancy and ensuring consistency.
In this post, we’ll break down how to transform an unorganized student-course dataset into its 1NF, 2NF, and 3NF forms step by step with SQL code and outputs.

Identify Anomalies
Insertion anomaly:
Can’t insert a new course unless a student enrolls.

Update anomaly:
If Dr. Kumar’s phone number changes, we must update multiple rows.

Deletion anomaly:
If student S02 drops the course, we lose info about the DBMS course entirely.

The Raw Table — 1NF (First Normal Form)
In the beginning, everything lives in one big table — students, courses, instructors, and even phone numbers.
Creation of table


Insertion of data

Output


2NF (Second Normal Form)
To fix redundancy, we break our data into four tables:
Create separate tables for Students, Courses, Instructors, Studentcourses.

Insertion of values


Output

Convert to 3NF (Third Normal Form)
Remove transitive dependency (non-key attributes shouldn’t depend on other non-keys).

👉 In our case, the InstructorPhone depends on Instructor, not directly on Course.
So we already separated Instructors, which makes this 3NF compliant.

Final tables in 3NF:

Students(StudentID, StudentName)
Instructors(Instructor, InstructorPhone)
Courses(CourseID, CourseName, Instructor)
StudentCourses(StudentID, CourseID)

JOIN: Combine Everything

Why Normalization Matters
Prevents data redundancy
Improves data consistency
Makes updates easier and safer
Ensures relational integrity

Key Takeaway

Database normalization is not just a theory — it’s what keeps your database organized, clean, and scalable.
Every efficient application you use today, from Instagram to banking apps, relies on normalized relational databases underneath.

Top comments (0)