Why normalize?
When the same fact is stored in many places, three kinds of anomalies appear:
- Update anomaly — change Rao’s office in one row but forget another → contradictory data.
- Insert anomaly — you can’t record a new course until a student enrolls in it.
- Delete anomaly — delete the only student in a course and you lose the course’s details too.
Normalization reorganises tables so that every fact is stored once.
Functional dependencies
A → B (“A functionally determines B”) means: if two rows have the same A, they must have the same B. Examples:
StudentID → NameCourseID → CourseName, InstructorInstructor → Office
Normal forms are rules about which dependencies are allowed.
The normal forms
First Normal Form (1NF)
- Every cell holds one atomic value (no lists, no repeating groups).
- Rows are uniquely identified by a primary key.
Second Normal Form (2NF)
- In 1NF, and
- no partial dependency: no non-key column depends on only part of a composite primary key.
Third Normal Form (3NF)
- In 2NF, and
- no transitive dependency: no non-key column depends on another non-key column.
A handy summary of 3NF: every non-key attribute must depend on “the key, the whole key, and nothing but the key.”
Worked example
Unnormalised:
| StudentID | Name | Courses |
|---|---|---|
| 101 | Asha | C1 DBMS Rao B-12 ; C2 OS Iyer A-03 |
1NF — one value per cell, key = (StudentID, CourseID):
| StudentID | Name | CourseID | Course | Instructor | Office |
|---|---|---|---|---|---|
| 101 | Asha | C1 | DBMS | Rao | B-12 |
| 101 | Asha | C2 | OS | Iyer | A-03 |
| 102 | Ravi | C1 | DBMS | Rao | B-12 |
Partial dependencies: StudentID → Name, CourseID → Course, Instructor, Office.
2NF — split by what each column depends on:
- Students(StudentID, Name)
- Enrollments(StudentID, CourseID)
- Courses(CourseID, Course, Instructor, Office)
Transitive dependency in Courses: CourseID → Instructor → Office.
3NF:
- Students(StudentID, Name)
- Enrollments(StudentID, CourseID)
- Courses(CourseID, Course, Instructor)
- Instructors(Instructor, Office)
Every fact now appears exactly once, and a JOIN brings the original view back:
SELECT s.StudentID, s.Name, c.CourseID, c.Course, c.Instructor, i.Office
FROM Students s
JOIN Enrollments e ON e.StudentID = s.StudentID
JOIN Courses c ON c.CourseID = e.CourseID
JOIN Instructors i ON i.Instructor = c.Instructor;
Beyond 3NF
- BCNF (Boyce–Codd): for every dependency
X → Y, X must be a superkey. Slightly stricter than 3NF. - 4NF: no multivalued dependencies; 5NF: no join dependencies.
Denormalization
Normalized designs need more joins, which can be slow for read-heavy analytics. Data warehouses sometimes denormalize on purpose (star schemas) — a conscious trade of redundancy for speed.
Common mistakes
- Thinking 1NF is only about “no duplicate rows” — atomic values matter too.
- Splitting tables without keeping the keys needed to join them back (a lossy decomposition).
- Over-normalizing small lookup data where the extra joins aren’t worth it.
Complexity at a glance
| Case / operation | Time | Why |
|---|---|---|
| Effect on reads | More joins | Data is split across tables. |
| Effect on writes | Fewer updates | Each fact is stored once. |
Quick check
Test yourself — pick an answer to see if you got it.
1. A table has a column "Phone numbers" containing "98100, 98111". Which normal form does it violate?
1NF requires every cell to hold a single atomic value.
2. Key (StudentID, CourseID), and StudentName depends only on StudentID. This is a…
A non-key column depending on part of a composite key breaks 2NF.
3. CourseID → Instructor and Instructor → Office. Office depends on CourseID…
The fix is to move Instructor → Office into its own table.
4. What is an update anomaly?
Redundant data must be updated everywhere it appears — miss one copy and the data contradicts itself.