Labs ICT
โญ Pro Login

Why Normalize?

Eliminating redundancy and preventing anomalies.

Why Normalize?

Normalization is the process of organizing a database to reduce redundancy and improve data integrity. Without normalization, you end up with duplicate data, update anomalies, and wasted storage.

The Problems Without Normalization


  UNNORMALIZED: StudentCourses Table
  โ”Œโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ ID โ”‚ Name    โ”‚ Courses                 โ”‚
  โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
  โ”‚ 1  โ”‚ Alice   โ”‚ Databases, Networking   โ”‚
  โ”‚ 2  โ”‚ Bob     โ”‚ Databases, OS           โ”‚
  โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

  Problems:
  โœ— Redundancy: "Alice" and "Databases" stored multiple times
  โœ— Update anomaly: If Alice changes name, must update multiple rows
  โœ— Insert anomaly: Can't add a course without a student
  โœ— Delete anomaly: Deleting Bob might lose course information

Normalization Process


  NORMALIZED:

  Students              Enrollments           Courses
  โ”Œโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ ID โ”‚ Name    โ”‚     โ”‚SID โ”‚CrsID    โ”‚     โ”‚ ID โ”‚ Title      โ”‚
  โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค     โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค     โ”œโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
  โ”‚ 1  โ”‚ Alice   โ”‚     โ”‚ 1  โ”‚ 101     โ”‚     โ”‚101 โ”‚ Databases  โ”‚
  โ”‚ 2  โ”‚ Bob     โ”‚     โ”‚ 1  โ”‚ 102     โ”‚     โ”‚102 โ”‚ Networking โ”‚
  โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚ 2  โ”‚ 101     โ”‚     โ”‚103 โ”‚ OS         โ”‚
                       โ”‚ 2  โ”‚ 103     โ”‚     โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ””โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

  โœ“ No redundancy
  โœ“ Update name? One place to change
  โœ“ Add course without student? Yes
  โœ“ Delete student? Course data preserved

๐Ÿงช Quick Quiz

What is the purpose of normalization?