Normalization & Database Design Principles: Mistakes
Module: Foundational Concepts
Storing comma-separated values: products VARCHAR(200)
Create ORDER_ITEMS table with product_id foreign key
Comma-separated values prevent atomic queries, violate 1NF, make updates error-prone.
Always use separate rows or junction tables for multiple values
High
Violates 1NF, cannot query individual products efficiently
Denormalizing without measuring performance first
Profile queries, identify bottlenecks, then denormalize specific tables
Denormalization trades integrity for speed. Only do it when measurements prove necessity.
Normalize first, denormalize only when profiling shows bottleneck
Medium
Premature optimization adds complexity without proven benefit
Missing foreign keys between related tables
Add FOREIGN KEY constraints: FOREIGN KEY (customer_id) REFERENCES customers(customer_id)
Foreign keys enforce relationships, prevent invalid data, enable CASCADE operations.
Always add foreign key constraints for relationships
High
Allows orphaned records, no referential integrity