SQL Database Normalization

Design clean, redundant-free relational schemas following 1NF, 2NF, and 3NF.

Database normalization organizes columns and tables to minimize duplicate data (redundancy) and prevent anomalies during insert, update, and delete operations.

  • 1NF: Atomic values in each column; unique records.
  • 2NF: In 1NF and no partial dependencies on composite keys.
  • 3NF: In 2NF and no transitive dependencies.

Key Takeaways: SQL Database Normalization

Mastering SQL Database Normalization helps you write clean and reliable SQL code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

SQL Database Normalization Code Example

SQL
-- Normalized order items table referencing orders and products
CREATE TABLE order_items (
  order_id INT NOT NULL,
  product_id INT NOT NULL,
  quantity INT NOT NULL,
  unit_price DECIMAL(10,2) NOT NULL,
  PRIMARY KEY (order_id, product_id),
  FOREIGN KEY (order_id) REFERENCES orders(id),
  FOREIGN KEY (product_id) REFERENCES products(id)
);
Output
Creates 3NF-compliant bridge table for order lines
Free sign-in required · Google login available
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services