Codacoda
Back to Academy

relational database

Normalization

Normalization is the process of organizing database tables to reduce redundancy and prevent update anomalies. First Normal Form (1NF) eliminates repeating groups, Second Normal Form (2NF) removes partial dependencies on composite keys, and Third Normal Form (3NF) removes transitive dependencies. Each successive form builds on the previous one.

Use Cases

  • Eliminating duplicate data like storing a customer's address in every order row
  • Preventing update anomalies where changing one copy of data leaves others stale
  • Designing clean schemas that are easy to maintain and extend over time
  • Reducing storage waste by storing each fact in exactly one place

Visualization

BEFOREorders (denormalized)order_idcustomerphoneitemprice1Alice555-0101Laptop9992Alice555-0101Mouse293Bob555-0202Keyboard79
Speed:1x
Denormalized table: customer data repeated in every order rowStep 1 / 5

Implementation

Output

Click "Run Code" to see output...