

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Table Relationships
incomplete
2: One to Many
incomplete
3: Many to Many
incomplete
4: Database Normalization
incomplete
5: Normal Forms
incomplete
6: First Normal Form (1NF)
incomplete
7: Second Normal Form (2NF)
incomplete
8: Third Normal Form (3NF)
incomplete
9: Boyce-Codd Normal Form (BCNF)
incomplete
10: Normalization Review
incomplete
11: Query Practice – Users & Banks
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
The creator of "database normalization," Edgar F. Codd described different "normal forms" a database can adhere to. We'll talk about the most common ones.
In short, first normal form is the least normalized form, and Boyce-Codd is the most normalized form we'll cover here.
The more normalized a database, the better its data integrity, and the less duplicate data you'll have.
In the context of database normalization, we're going to use the term "primary key" slightly differently. When we're talking about SQLite, a "primary key" is a single column that uniquely identifies a row.
When we're talking more generally about data normalization, the term "primary key" means the collection of columns that uniquely identify a row. That can be a single column, but it can actually be any number of columns that form a composite key. A primary key is the minimum number of columns needed to uniquely identify a row in a table.
If you think back to the many-to-many joining table product_suppliers, that table's "primary key" was actually a combination of the two IDs, product_id and supplier_id:
CREATE TABLE product_suppliers (
product_id INTEGER,
supplier_id INTEGER,
UNIQUE(product_id, supplier_id)
);