Database Design and Normalization

Lesson 7 of 10Grades 9–12

Good database design prevents bugs, reduces storage waste, and makes queries faster. Normalization is the process of organizing your tables to eliminate redundancy and keep data consistent.

Key Concepts

Primary Keys

Every table should have a primary key — a column (or combination) that uniquely identifies each row. IDs are commonly used: id INT AUTO_INCREMENT PRIMARY KEY. Primary keys cannot be NULL and must be unique.

Normal Forms

First Normal Form (1NF): each cell has one value, no repeating groups. Second Normal Form (2NF): no partial dependencies. Third Normal Form (3NF): no transitive dependencies. In practice: if the same information appears in multiple rows, put it in its own table.

Indexes

An index is like a book's index — it lets the database find rows without scanning every row. Primary keys are automatically indexed. Add indexes to columns you filter or join on frequently. Too many indexes slow down writes, so index strategically.

🆕 Normalization Visualizer

See how a bad table design is normalized into multiple linked tables.

✅ Check Your Understanding

1. What is a primary key?

2. Why is normalization useful?

3. What is an index in a database?