Definitions:

  • Multi-valued Dependency:

    • When an attribute has a specific of available values
    • : Each model has possible color
  • Attribute: Column/variable of a database table

  • Normal Form (NF):

    • Rules to prevent bad database design (not normalized), causing data integrity failure
    • Prevent redundancy, contradiction, and anomalies (insertion, update, deletion)
    • Makes databases easier to understand, enhance, extend

1 NF

  1. Don’t use row order to convey information.
  2. Don’t mix data types within the same column.
  3. Don’t have a table without a primary key/foreign key.
  4. Don’t have repeating groups.
  5. Don’t hold more than 1 value in 1 cell.

2 NF

Each non-key column attribute must depend on the entire primary key

If not 2NF: Vulnerable to deletion, update, insertion anomaly

  • ✅:

  • ❌:

    is treated as a key, yet is independent of it.

3 NF (Boyce-Codd Normal Form)

Every attribute in a table should depend on the key, the whole key, and nothing but the key

If not 3NF: Vulnerable to update anomaly

  • is not a key, yet depends on it.

    Update anomaly occurs when is updated, yet for some reason is not updated, causing inconsistensy.

4 NF

TODO

Multi-valued dependencies in a table must be multi-valued dependencies on the key

  • For example, table of: The table above violates 4 NF, because key is all ?Solution is separate to two tables, ,

5 NF

The table (which must be 4 NF) cannot be describable as the logical result of joining some other tables together.

  • References table
  • ❌: table
  • ✅: table & table

References