Docsity

Functional Dependency and Normal Forms in Database Systems, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Functional Dependency and Normal Forms in Database Systems and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Functional Dependancy

Definition:

  • constraints on relations
  • characteristic of an attribute where values are determined by another attribute’s values

Notation:

  • α→β (α determines β)
  • (α→β may take the form AB→C, A→BC, etc.)

Characteristics

Functional dependency holds if:

  • t 1 [β] = t 2 [β] where t 1 [α] = t 2 [α]; β is functionally dependent on α if value of α in tuples t 1 and t 2 determines value of β in tuples t 1 and t 2.
  • Or, for each value of α, there is only 1 corresponding value of β.

Uses for Functional Dependancy

  • To determine if a relation is in a Normal

Form.

  • To specify constraints on the set of legal

relations (functional dependencies to focus

on)

  • To determine if a decomposition would

cause data loss (R decomposed to R 1 and R 2

but, R 1 |X| R 2 ≠ R)

Terms

Trivial:

  • A→A and AB→A are trivial because A is a subset of A and AB

Satisfy/Hold:

  • Relation R satisfies functional dependency α→β if t1[β] = t2[β] wherever t1[α] = t2[α]; conversely functional dependency α→β holds on relation R.

Closure Rules of Inference

  • Armstrong’s Axioms:
    • Reflexivity rule:
      • if α is a set of attributes and β is contained in α then α→β
      • i.e. given AB→C, then A→B
    • Augmentation rule:
      • given α→β and another set of attributes γ, then γα→γβ
    • Transitivity rule:
      • if α→β and β→γ , then α→γ

Closure Rules of Inference Cont.

  • Other Rules:
    • Union rule:
      • if α→β and α→γ , then α→βγ
    • Decomposition rule:
      • if α→βγ , then α→β and α→γ
    • Pseudotransitivity rule:
      • if α→β and γβ→δ , then γα→δ

Decomposition into BCNF

  • If α→β and relation R is not in BCNF,

decompose R into two relations

(α U β) and (R - (β - α))

  • if decompositions are not in BCNF, repeat

Example

  • Given relation R(A, B, C)
    • AB is the Superkey, B alone is not
    • if F = {(B→C)} required to hold, then R is not in BCNF; R decomposes to (B,C) and (A,B)
    • if F = {(A→B), (B→C)} required to hold, then F +^ = {(A→B), (B→C), (A→C), (AB→C)}, and F (^) c = {(AB→C)}; R is in BCNF

Decomposition into 3NF

  • Same as with BCNF
  • does not require decomposition if each

attribute in β, but not in α, is contained in a

candidate key

Example

  • Given relation R(A, B, C, D)
    • AB is the Superkey, BC is a candidate key
    • if F = {(A→C)} required to hold, R is in 3NF since C - A exists in BC; no decomposition required

Decomposition into 4NF

  • Same as with BCNF
  • treat dependencies involving multivalued

attributes as part of the constraints

(text says the opposite - treat functional

dependencies as multivalued dependencies,

then use all multivalued dependencies as

contraints)

Example

  • Given relation R(A, B, C, D)
    • AB is the Superkey, D is multivalued and B→D
    • if F = {(A→C)} required to hold, then treat as F = {(A→C), (B→D)}
    • R is not in 4NF; R decomposes to (A,C) and (A,B,D); (A,B,D) is not in 4NF, so decompose again to (B,D) and (A,B). Result: {(A,C), (B,D), (A,B)}