Docsity

Poor Schema Design - Database Design - Lecture Slides, Slides of Database Management Systems (DBMS)

Toggle sidebar
bg1
Multivalued Dependency
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Poor Schema Design - Database Design - Lecture Slides and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Multivalued Dependency

Not All Designs are Equally Good

This is a poor schema design

Is this one better?

StudentInfo(sid, sname, crno, subj, cid, exp-grade)

Student(sid, sname) Course(crno, cid) Subject(cid, subj) Takes(sid, crno, exp-grade)

Functional Dependencies

Def. Given a relation schema R and subsets X,

Y of R:

An instance r of R satisfies FD X  Y if, for any two tuples t1, t2 2 r, t1[X ] = t2[X] implies t1[Y] = t2[Y]

  • For an FD to hold for schema R, it must hold

for every possible instance of r

Functional Dependencies

Describe “Key-Like” Relationships

A key is a set of attributes where: If keys match, then the tuples match

A functional dependency (FD) is a generalization:

If an attribute set determines another, written X! Y then if two tuples agree on attribute set X, they must agree on Y:

sid! sname

Armstrong’s Axioms Lead to…

  • Union: If X  Y and X  Z then X  YZ
  • Pseudotransitivity: If X  Y and WY  Z then XW  Z
  • Decomposition: If X  Y and Z  Y then X  Z

Armstrong’s axioms

  • Armstrong’s axioms are sound and complete

inference rules for FDs!

  • Sound: all the derived FDs (by using the axioms) are those logically implied by the given set
  • Complete: all the logically implied (by the given set) FDs can be derived by using the axioms.

Consider FDs

Example

F= {A→C, B→C, CD→E}, let show that

AD→E:

1) A→C (given)

2) AD→CD (Augmentation)

3) CD→E (given)

4) AD→E (2, 3 and Transitivity)

One more Ex.

R(C S Z), CS→Z, Z →C

What is the relation NF?

  • Z->C (given) SZ->SC (Augmentation)

SZ->Z (Transitivity) SZ->C (Transitivity)

 All attributes are PRIME (since CS and ZS are keys)  Therefore, in 3NF, but not in BCNF

Example of computing X+

F={A B, AC D, AB C}

  1. result=A A B
  2. result=AB AB->C
  3. result=ABC ABC->BD
  4. result=ABCD

X+ {ABCD}

Finding primary key Ex.

• R: ( A, B, C, D, E, F )

• F={A  B, BC  A, D  EF, B  D, A  C}

  • Task: Find the candidate key(s) and identify a primary key

A->B B->D D->EF A->BDEF

A->C

A->BCDEF