Database.What is “normalization”?

📚 What is Normalization in Databases?

Normalization is the process of organizing data in a database to reduce redundancy and improve data integrity. It involves dividing large, complex tables into smaller, related tables and defining relationships between them.


🎯 Goals of Normalization:

  • Eliminate duplicate data (e.g., repeating groups or columns)
  • Ensure data dependencies make sense
  • Simplify updates, inserts, and deletes
  • Prevent anomalies (update, insert, delete anomalies)

🧱 Normal Forms (NF) – The Stages of Normalization:

Each level is stricter than the previous. The first three are most commonly applied.

1NF (First Normal Form)

  • Eliminate repeating groups
  • Ensure atomic values (each field contains only one value)

✅ Good:

Hobbies: ["reading", "biking"]
❌ Bad:
Hobbies: "reading, biking"

2NF (Second Normal Form)

  • Must be in 1NF
  • Remove partial dependencies (i.e., no non-key column depends on part of a composite key)

✅ Example: Split a table where some data only depends on part of the key.

3NF (Third Normal Form)

  • Must be in 2NF
  • Remove transitive dependencies (i.e., non-key columns should not depend on other non-key columns)

✅ Example: Instead of storing city_name and city_zip in the same table, move city_zip to a separate table.

🔄 Example Before and After Normalization:

Unnormalized Table

OrderIDCustomerNameCustomerEmailProduct
101Alicea@mail.comLaptop
102Alicea@mail.comPhone

After Normalization

Customers Table

CustomerIDNameEmail
1Alicea@mail.com

Orders Table

OrderIDCustomerIDProduct
1011Laptop
1021Phone

🧠 Why Normalize?

BenefitExplanation
Reduces redundancyData is not unnecessarily duplicated
Improves consistencyChanges happen in one place only
Prevents anomaliesAvoids strange behaviors on insert/delete/update
Makes relationships clearEasier to manage and query
This entry was posted in Без рубрики. Bookmark the permalink.