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

Table 4.11. assignments

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

Table 4.12. astronauts

id (PK)

firstname

lastname

1

Melissa

Lewis

2

Mark

Watney

3

Rick

Martinez

Table 4.13. missions

id (PK)

year

mission

1

2031

Ares1

2

2033

Ares2

3

2035

Ares3

Table 4.14. assignments

id (PK)

astronaut_id (FK)

mission_id (FK)

1

1

3

1

2

3

1

3

3

../../_images/normalform-2nd-primarykey.png

Figure 4.9. All data must depend on the Primary Key. Image credit: [1]

4.3.3. Recap

../../_images/normalform-2nd-summary.png

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

4.3.4. References