Docsity

Data Normalization: Understanding Functional Dependencies and Keys, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Data Normalization: Understanding Functional Dependencies and Keys and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Keys and Functional Dependency

Data Normalization

  • Primarily a tool to validate and improve a logical

design so that it satisfies certain constraints that

avoid unnecessary duplication of data.

  • The process of decomposing relations with anomalies

to produce smaller, well-structured relations.

  • Primary Objective: Reduce Redundancy,Reduce nulls,
  • Improve “modify” activities:
    • insert,
    • update,
    • delete,
    • but not read
  • Price: degraded query, display, reporting

Functional dependency

• a constraint between two attributes (columns)

or two sets of columns

• A  B if “for every valid instance of A, that

value of A uniquely determines the value of B”

• or …A B if “there exists at most one value of

B for every value of A”

X Y Z

X Y Z

Functional Dependencies (example)

… functional dependency

• some examples

• SSN  Name, Address, Birthdate

• VIN  Make, Model, Color

• note: the LHS is the determinant

• so functional dependency is the technical

term for determines

Armstrong’s Axioms

For computing the set of FDs that follow a given FD, the

following rules called Armstrong’s axioms are useful:

  1. Reflexivity: If B ⊆ A, then A  B
  2. Augmentation: If A  B, then A ∪ C  B ∪ C

Note also that if A  B, then A ∪ C  B for any set of attributes C.

  1. Transitivity: If A  B and B  C then A  C

Example of 3NF but not BCNF

• R(A B C D)

• Is this table BCNF?

Inference Rules for FD’s

Is equivalent to

Splitting rule and Combining rule

A1 ... Am B1 ... Bm

A 1 , A 2 , …, An  B 1 , B 2 , …, Bm

A 1 , A 2 , …, An  B 1 A 1 , A 2 , …, An  B 2

..... A 1 , A 2 , …, An  Bm

Inference Rules for FD’s

(continued)

Trivial Rule

Why?

A 1 … Am

where i = 1, 2, ..., n

A 1 , A 2 , …, An  Ai

A 1 … Am B 1 … Bm C 1 ... Cp

Example (continued)

Start from the following FDs:

Infer the following FDs:

  1. name  color
  2. category  department
  3. color, category  price

Inferred FD Which Rule did we apply?

  1. name, category  name
  2. name, category  color
  3. name, category  category
  4. name, category  color, category
  5. name, category  price Docsity.com

Problem: infer ALL FDs

Given a set of FDs, infer all possible FDs

How to proceed?

  • Try all possible FDs, apply all 3 rules
    • E.g. R(A, B, C, D): how many FDs are possible?
  • Drop trivial FDs, drop augmented FDs
    • Still way too many
  • Better: use the Closure Algorithm (next)

Closure of a set of Attributes

Given a set of attributes A 1 , …, An

The closure , {A 1 , …, An } +^ , is the set of attributes B s.t. A 1 , …, An  B

name  color category  department color, category  price

Example:

Closures: name +^ = {name, color} {name, category}+^ = {name, category, color, department, price} color +^ = {color}