Menu

1 / 2

Database Normalization Explained

DEV Community·丁久·5 months ago
#cYAuBzeY
#database#sql#software#coding#normalization
Reading 0:00
15s threshold

This article was originally published on AI Study Room . For the full version with working code examples and related articles, visit the original post.

Database Normalization Explained

Database Normalization Explained

Database Normalization Explained

Database Normalization Explained

Database Normalization Explained

Database Normalization Explained

Database Normalization Explained

Database Normalization Explained

What is Normalization?

Normalization organizes data to reduce redundancy and improve integrity. Each piece of data is stored in exactly one place.

Normal Forms

First Normal Form (1NF)

Each column contains atomic values. Each row is unique.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\-- Violates 1NF

CREATE TABLE orders (id SERIAL, products TEXT); -- "Laptop,Mouse"

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\-- 1NF compliant

CREATE TABLE order_items (

order_id INT REFERENCES orders(id),

product_name TEXT,

PRIMARY KEY (order_id, product_name)

);

Second Normal Form (2NF)

Must be in 1NF.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.