Database Normalization
First Normal Form
Violations
- Using Row Order to convey information about the data
| Issue | Solution |
|---|---|
Table Name: Student Names from Tallest to Shortest![]() | ![]() |
Relational Databases Do NOT have "ordering" for rows
- Mixing Data types
| Issue | Solution |
|---|---|
![]() | Keep things in same data type in same column |
-
Making a Table without a primary key One Row or Combination of Rows should act as the primary key for each table to avoid adding nonsense data
-
Having arrays (i.e. repeating groups) inside a column
| Issue | Solution |
|---|---|
![]() | ![]() |
Second Normal Form
This is about how the non-key columns of a table relate to the Primary Key
When second normal form is not satisfied, database will be vulnerable to "Anomalies",
- Insertion Anomalies - Record cannot be inserted since it lacks "some" data initially
- Update Anomalies - Updates make data inconsistent by keeping records in multiple places
- Deletion Anomalies - Deleting one information will also delete some other wanted information

Rules
- Each Non-Key attributes of the table must depend on the entire primary key

Solution:

Third Normal Form
All attributes must depend on the entire primary key directly without any transitive dependencies
Every non-key attribute in a table should depend on the key, the whole key, and nothing but the key.
| Issue | Solution |
|---|---|
![]() ![]() | ![]() |
Boyce-Codd Normal Form
Slightly improved version of the 3rd normal form. This is extremely similar to 3rd normal form and difference is,
Every
non-keyattribute in a table should depend on the key, the whole key, and nothing but the key.
4th Normal Form
Don't store two unrelated multi-valued facts in one table. For example, (Model, Color, Style), where color and styles have nothing to do with each other, should become two tables.
When this happens, if we wanna add a new Color, we need to add two or more rows to make sure it keep consistent with all Style items
| Issue | Solution |
|---|---|
![]() | ![]() |
5th Normal Form
Deals with rare cases where a table can only be rebuilt correctly by joining three or more smaller tables.
Images from - https://youtu.be/GFQaEYEc8_8









