Database normalization is a systematic approach to organizing data in a relational database that eliminates redundancy and ensures data integrity. Created by Edgar F. Codd in the 1970s, normalization consists of several "normal forms" that represent increasingly stringent rules for database design.
In real-world applications, proper normalization offers critical benefits:
Determine all real-world entities and their properties.
Real-world example: An e-commerce platform needs to track customers, products, orders, and payments.
Customer: customer_id, name, email, phone, address, city, state, postal_code
Product: product_id, name, description, price, category, stock_quantity
Order: order_id, customer_id, order_date, shipping_address, total_amount
Define tables and ensure each has a unique identifier.
CREATE TABLE customers (
customer_id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100),
phone VARCHAR(20),
address TEXT,
city VARCHAR(50),
state VARCHAR(30),
postal_code VARCHAR(20)
);