Docsity

Understanding 4NF: Eliminating Nontrivial Multi-Valued Dependencies, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Understanding 4NF: Eliminating Nontrivial Multi-Valued Dependencies and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Why 4NF?

• Performance

– We want database to take up

less space.

Why 4NF?

  • To reduce the need for:
    • inserts,
    • updates
    • deletes

Normal Forms Comparison

Normal Form # What you need?

1NF

Remove repeating Groups

2NF

Remove Partial Dependencies

3NF

Remove Transitive Dependencies

BCNF

Make sure every determinant is a Candidate Key

4NF

Remove nontrivial Multi-Valued Dependencies (MVD)

Recap of 4NF Definition

  • No non-trivial multi-valued dependencies
    • Except on superset of a candidate key
    • Multi-valued dependencies are functional dependencies.
  • Table must be in BCNF

Recap of 4NF Definition

  • No Duplications
  • Table must be in BCNF

Example to get 4NF

  • Decomposed into two tables From Reference #

Example 2: Is it in 3NF or BCNF?

Restaurant Pizza Variety Delivery Area A1 Pizza Thick Crust Springfield A1 Pizza Thick Crust Shelbyville A1 Pizza Thick Crust Capital City A1 Pizza Stuffed Crust Springfield A1 Pizza Stuffed Crust Shelbyville A1 Pizza Stuffed Crust Capital City Elite Pizza Thin Crust Capital City Elite Pizza Stuffed Crust Capital City Vincenzo's Pizza Thick Crust Springfield Vincenzo's Pizza Thick Crust Shelbyville Vincenzo's Pizza Thin Crust Springfield Vincenzo's Pizza Thin Crust Shelbyville

Pizza Delivery

From Reference #

Example 2: Is it in 4NF?

Restaurant Pizza Variety Delivery Area A1 Pizza Thick Crust Springfield A1 Pizza Thick Crust Shelbyville A1 Pizza Thick Crust Capital City A1 Pizza Stuffed Crust Springfield A1 Pizza Stuffed Crust Shelbyville A1 Pizza Stuffed Crust Capital City Elite Pizza Thin Crust Capital City Elite Pizza Stuffed Crust Capital City Vincenzo's Pizza Thick Crust Springfield Vincenzo's Pizza Thick Crust Shelbyville Vincenzo's Pizza Thin Crust Springfield Vincenzo's Pizza Thin Crust Shelbyville

Pizza Delivery

From Reference #

Example 2: Is it in 4NF?

  • If we assume, that pizza varieties offered by a restaurant are not affected by delivery area, then it does not meet 4NF.
  • The answer is NO. From Reference #

Why not in 4NF?

  • The table has two non-trivial multivalued dependencies on the {Restaurant} attribute (which is not a superkey).
  • The dependencies are:
    • {Restaurant} →→ {Pizza Variety}
    • {Restaurant} →→ {Delivery Area} From Reference #

How to “fix it” (4NF)?

Restaurant Pizza Variety Delivery Area A1 Pizza Thick Crust Springfield A1 Pizza Thick Crust Shelbyville A1 Pizza Thick Crust Capital City A1 Pizza Stuffed Crust Springfield A1 Pizza Stuffed Crust Shelbyville A1 Pizza Stuffed Crust Capital City Elite Pizza Thin Crust Capital City Elite Pizza Stuffed Crust Capital City Vincenzo's Pizza Thick Crust Springfield Vincenzo's Pizza Thick Crust Shelbyville Vincenzo's Pizza Thin Crust Springfield Vincenzo's Pizza Thin Crust Shelbyville

Pizza Delivery

From Reference #

Two Non-

trivial: MVD

Practice Example

  1. Is this 3NF or BCNF?
  2. Is this 4NF?
  3. If not, what are the decomposed tables in 4NF? Restaurant Pizza Variety Delivery Area A1 Pizza Thick Crust Springfield A1 Pizza Thick Crust Shelbyville A1 Pizza Thick Crust Capital City A2 Pizza Stuffed Crust Springfield A2 Pizza Stuffed Crust Shelbyville

Pizza Delivery

Practice Example (Answer)

1. BCNF 2. NO 3. See Below

Restaurant Pizza Variety

A1 Pizza Thick Crust

A1 Pizza Stuffed Crust

A2 Pizza Stuffed Crust

Restaurant Delivery Area

A1 Pizza Springfield

A1 Pizza Shelbyville

A1 Pizza Capital City

A2 Pizza Springfield

A2 Pizza Shelbyville

Varieties By Restaurant

Delivery Areas By Restaurant

No Duplications among rows! Yay!