functional dependency class lecture

Upload: sahilchadha522

Post on 09-Apr-2018

237 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 Functional Dependency Class Lecture

    1/20

    Functional Dependency

    Minakshi.

  • 8/8/2019 Functional Dependency Class Lecture

    2/20

    To determine F+, we need rules for deriving all functionaldependencies that are implied by F. A set of rules that may beused to infer additional dependencies was proposed by

    Armstrong in 1974. These rules (or axioms) are a complete setof rules in that all possible functional dependencies may bederived from them.

  • 8/8/2019 Functional Dependency Class Lecture

    3/20

    For example, the studentrelation has the

    following functional dependencies

    sno -> sname cno -> cname sno -> address cno ->instructor instructor -> office

    Let these dependencies be denoted byF. The

    closure ofF, denoted byF+, includes Fand all

    functional dependencies that are implied byF.

  • 8/8/2019 Functional Dependency Class Lecture

    4/20

    These rules are called Armstrong'sAxioms.

    Reflexivity Rule --- If X is a set of attributes and Y is a subsetof X, then X -> Yholds. The reflexivity rule is the mostsimple (almost trivial) rule. It states that each subset of X isfunctionally dependent on X.

    Augmentation Rule --- IfX -> Yholds and W is a set of

    attributes, thenWX -> WYholds. The augmentation rule isalso quite simple. It states that if Y is determined by X then aset of attributes W and Y together will be determined by Wand X together. Note that we use the notation WX to meanthe collection of all attributes in W and X and write WX ratherthan the more conventional (W, X) for convenience.

    Transitivity Rule --- IfX -> YandY -> Z hold, then X -> Zholds. The transitivity rule is perhaps the most important one.It states that if X functionally determines Y and Y functionallydetermines Z then X functionally determines Z.

  • 8/8/2019 Functional Dependency Class Lecture

    5/20

    Further axioms may be derived from the above although the abovethree axioms are sound and complete in that they do not generateany incorrect functional dependencies (soundness) and they dogenerate all possible functional dependencies that can be inferredfrom F(completeness). For proof of soundness and completeness ofArmstrong's Axioms, the reader is referred to Ullman (Vol 1, page387). The most important additional axioms are:

    Union Rule --- IfX -> YandX -> Zhold, thenX -> YZholds.

    Decomposition Rule --- IfX -> YZholds, then so doX -> YandX ->Z.

    Pseudotransitivity Rule --- IfX -> Yand WY -> Zhold then so doesWX -> Z.

  • 8/8/2019 Functional Dependency Class Lecture

    6/20

    Examples

    sno, cno) -> sno (Rule 1)

    (sno, cno) -> cno (Rule 1)

    (sno,c

    no)->

    (sname,c

    name) (Rule 2)cno -> office (Rule 3)

    sno -> (sname,address) (Union Rule)

    etc.

  • 8/8/2019 Functional Dependency Class Lecture

    7/20

    Closure of a set of Functional

    dependenciesConsider a relation

    R=(A,B,C,G,H,I)

    anda set of Functional dependencies

    A B

    A CCG H

    CG I

    B H

  • 8/8/2019 Functional Dependency Class Lecture

    8/20

    some members ofF+

    Ap H by transitivity fromAp B andBp H

    AGp I by augmentingAp Cwith G, to getAGp CG

    and then transitivity with CGp I

    CGp HI

    by augmenting CGp Ito inferCGp CGI,and augmenting ofCGp Hto inferCGIp HI,

    and then transitivity

  • 8/8/2019 Functional Dependency Class Lecture

    9/20

  • 8/8/2019 Functional Dependency Class Lecture

    10/20

  • 8/8/2019 Functional Dependency Class Lecture

    11/20

  • 8/8/2019 Functional Dependency Class Lecture

    12/20

  • 8/8/2019 Functional Dependency Class Lecture

    13/20

    R=(A,B,C,D,E)

    Compute the closure of the following set of

    functional dependencies A BC

    CD E

    B D E A

  • 8/8/2019 Functional Dependency Class Lecture

    14/20

  • 8/8/2019 Functional Dependency Class Lecture

    15/20

  • 8/8/2019 Functional Dependency Class Lecture

    16/20

    R = (A,B,C, G,H,I)

    F = {Ap B

    Ap C

    CGp H

    CGp I

    Bp H}

    Compute (AG)+

    Example of Attribute Set Closure

  • 8/8/2019 Functional Dependency Class Lecture

    17/20

  • 8/8/2019 Functional Dependency Class Lecture

    18/20

  • 8/8/2019 Functional Dependency Class Lecture

    19/20

  • 8/8/2019 Functional Dependency Class Lecture

    20/20