> [!tldr] Normal Forms
> **Normal forms (NF)** are criteria in relational database normalization. In particular the first ~ sixth normal forms (1NF ~ 6NF) are a series of nested (and increasingly strict) criteria.
### 1NF
1NF requires:
- Primary keys.
- No ordering in rows or columns (e.g. a list of students' performances cannot convey their score rankings via row order).
- No repeated groups, i.e. each cell should only contain one piece of information (e.g. there shouldn't be a comma-separated-list of transaction records in a row corresponding to a user).
### 2NF
2NF requires 1NF, as well as:
The values of any column that is not a primary key need to be determined by every primary key,
- Not a subset of them: e.g. in a table with primary key customer and call id, there may not be a column about the customer's age, which does not depend on the call id
### 3NF
3NF requires 2NF and further requires non-key attributes need to depend on the primary keys alone, and not any other column:
- E.g. in a user demographics table, if an age band column is only determined by age (so indirectly on user ID), then it satisfies 2NF but violates 3NF.
### 4NF
4NF requires 3NF, and that multi-valued dependencies must depend on the entire primary key.
- E.g. in a table recording the products and shipping methods in different store locations, the products and shipping methods are part of the primary key, but they are multi-valued dependencies that depend on the store location alone.
- Instead, they should be stored separately in a table mapping store location $\to$ products and another mapping store location $\to$ shipping methods.
### 5NF
5NF requires 4NF, and that the table cannot be formed by joining simpler ones.