4.3. 2nd Normal Form¶
All data must depend on the Primary Key
All attributes (non-key columns) dependent on the key (PK)
4.3.1. Problem¶
id (PK) |
firstname |
lastname |
year |
mission |
---|---|---|---|---|
1 |
Melissa |
Lewis |
2035 |
Ares3 |
2 |
Mark |
Watney |
2035 |
Ares3 |
3 |
Rick |
Martinez |
2035 |
Ares3 |
4.3.2. Solution¶
id (PK) |
firstname |
lastname |
---|---|---|
1 |
Melissa |
Lewis |
2 |
Mark |
Watney |
3 |
Rick |
Martinez |
id (PK) |
year |
mission |
---|---|---|
1 |
2031 |
Ares1 |
2 |
2033 |
Ares2 |
3 |
2035 |
Ares3 |
id (PK) |
astronaut_id (FK) |
mission_id (FK) |
---|---|---|
1 |
1 |
3 |
1 |
2 |
3 |
1 |
3 |
3 |

Figure 4.10. All data must depend on the Primary Key. Image credit: [1]¶
4.3.3. Recap¶

Figure 4.11. If all data depend on the Primary Key the database achieved 2nd Normal Form.¶