pert.12.normalization cont (tugas teori)

Upload: ramansa93

Post on 07-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    1/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    2/27

    Slide 11-2Elmasri and Navathe, Fundamentals of Database Systems, Fourth EditionRevised by IB & SAM, Fasilkom UI, 2005

    Exercise Multiple Choices

    Which of the following is known to be true from thefunctional dependency shown as (A, B) (C, D)?a. A is the determinant of Cb. A and B together are determined by C and D togetherc. A and B together determine D

    d. C and D together determine Ae. A determines B

    Which of the following is not a requirement for 1NF?a. cells must contain single values

    b. all entries in a column must be of the same kindc. no two rows may be identicald. rows must be ordered by the value of the primary keye. the order of the columns is insignificant

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    3/27

    Further Normalization

    The main reference of this preElmasri &Navathe, Fundamentalthedition,2004, Chapter 11Additional resources: presentDemurjian, Sr (http://www.engr.

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    4/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    5/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    6/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    7/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    8/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    9/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    10/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    11/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    12/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    13/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    14/27

    Slide 11-14Elmasri and Navathe, Fundamentals of Database Systems, Fourth EditionRevised by IB & SAM, Fasilkom UI, 2005

    What are Possible Decompositions?

    S#

    S1

    S2

    S3S4

    D1

    D1

    D2D3

    DHead

    John

    John

    Smith

    Black

    DName

    G Information Based

    R = ( U, F ) U = { S#, DName, DHead }

    F = { S#o DName, DName o DHead }

    G = { R1(S#, ), R2(DName, R3(DHead, )}G is Neither Lossless nor FD-Preserving

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    15/27

    Slide 11-15Elmasri and Navathe, Fundamentals of Database Systems, Fourth EditionRevised by IB & SAM, Fasilkom UI, 2005

    What are Possible Decompositions?

    S# DName

    S1

    S2

    S3

    S4

    D1

    D1D2

    D3

    S# DHead

    S1

    S2S3

    S4

    John

    JohnSmith

    Black

    G Lossless Decomposition but

    not Dependency-Preserving

    DNameo DHead is lost inthe decomposition

    R = ( U, F ) U = { S#, DName, DHead }

    F = { S#o DName, DName o DHead }

    G = { R1({S# ,DName}, {S#o DName}),R2({S#, DHead}, {S#o DHead})}

    Gis Lossless but not FD-Preserving

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    16/27

    Slide 11-16Elmasri and Navathe, Fundamentals of Database Systems, Fourth EditionRevised by IB & SAM, Fasilkom UI, 2005

    What are Possible Decompositions?

    S# DName

    S1

    S2

    S3

    S4

    D1

    D1

    D2D3

    DName DHead

    John

    JohnD1

    D1

    D2D3

    G Lossless & dependency-

    preserving decomposition

    R = ( U, F ) U = { S#, DName, DHead }

    F = { S#o DName, DName o DHead }

    = { R1({S# ,DName}, {S# o DName})R3({DName, DHead}, {Dname o DHead})}

    G is both Lossless and FD-Preserving

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    17/27

    Slide 11-17Elmasri and Navathe, Fundamentals of Database Systems, Fourth EditionRevised by IB & SAM, Fasilkom UI, 2005BCNF

    Eliminate the Partial Functional

    Dependencies of Non-primeAttributes to Key Attributes

    Eliminate the Transitive

    Functional Dependencies ofNon-prime Attributes to KeyAttributes

    Eliminate the Partial andTransitive FunctionalDependencies of Prime (Key)Attributes to Key

    Lossless Decomposition

    but not DependencyPreserving

    Lossless Decomposition

    and Dependency Preserving2NF

    3NF

    1NF

    Summary of Normalization

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    18/27

    Slide 11-18Elmasri and Navathe, Fundamentals of Database Systems, Fourth EditionRevised by IB & SAM, Fasilkom UI, 2005

    The Entire Normalization Picture1NF

    2NF

    3NF

    BCNF

    Eliminate Partial FDs of

    Non-prime Attributes to Key

    Eliminate Transitive FDs of Non-prime

    Attributes to Key

    Eliminate Partial and Transitive FDsof Prime Attributes to Key

    4NF

    Eliminate Non-trivial and Non-

    functional Multi-Valued Dependencies

    5NF

    Eliminate Join Dependencies that are

    Not Implied by Candidate Key

    Wh t M lti V l d

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    19/27

    Slide 11-19Elmasri and Navathe, Fundamentals of Database Systems, Fourth EditionRevised by IB & SAM, Fasilkom UI, 2005

    What are Multi-ValuedDependencies?

    Focused on the Concept of Multi-Valued Dependencies

    A MVD X oo Y Indicates that a Value of X Correspondsto Multiple Values of Y

    Consider EMP with MVDs:

    ENAME ooPNAME (E works on many Project)

    ENAME oo DNAME (E has many Dependents)

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    20/27

    Slide 11-20Elmasri and Navathe, Fundamentals of Database Systems, Fourth EditionRevised by IB & SAM, Fasilkom UI, 2005

    What is Fourth Normal Form (4NF)? A Relation Schema R is in Fourth Normal Form (4NF)

    w.r.t Dependencies F (FD and MVD) if for every Non-Trivial MVD X oo Y in F+, X is a Superkey for R

    MVD X oo Y in R is called trivial ifY is subset of X, or

    X U Y = R Reconsider EMP with MVDs:

    ENAME oo PNAME (E works on many P)ENAME oo DNAME (E has many Dependents)

    ENAME is Not a Superkey of R since Need Triple ofENAME, PNAME, and DNAME to Distinguish

    We need to Decompose EMP!

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    21/27

    Slide 11-21Elmasri and Navathe, Fundamentals of Database Systems, Fourth EditionRevised by IB & SAM, Fasilkom UI, 2005

    Notes on FD

    A functional dependency is trivial if it issatisfied by all instances of a relationE.g.

    customer-name, loan-number o customer-name customer-name o customer-name

    In general, D o Eis trivial ifE D

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    22/27

    Slide 11-22Elmasri and Navathe, Fundamentals of Database Systems, Fourth EditionRevised by IB & SAM, Fasilkom UI, 2005

    Decomposition into 4NF

    ENAMEooPNAME is Trivial MVD: EPNAMEqual to EMP_PROJECTS (samENAMEooDNAM

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    23/27

    Slide 11-23Elmasri and Navathe, Fundamentals of Database Systems, Fourth EditionRevised by IB & SAM, Fasilkom UI, 2005

    Multivalued Dependencies and 4NF

    Decomposing a relation state of EMP that is not in 4NF. (a) EMP relation with

    additional tuples. (b) Two corresponding 4NF relations EMP_PROJECTS andEMP_DEPENDENTS.

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    24/27

    Slide 11-24Elmasri and Navathe, Fundamentals of Database Systems, Fourth EditionRevised by IB & SAM, Fasilkom UI, 2005

    Other Normalizations

    You can read by yourself

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    25/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    26/27

  • 8/6/2019 PERT.12.Normalization Cont (Tugas Teori)

    27/27

    Slide 11-27Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition

    Exercise 10.33

    Consider the following relation for published books: BOOK (Book_title, Authorname, Book_type, Listprice,

    Author_affil, Publisher) Author_affil referes to the affiliation of the author. Suppose the

    following dependencies exist: Book_title -> Publisher, Book_type Book_type -> Listprice Author_name -> Author-affil

    (a) What normal form is the relation in? Explain your

    answer. (b) Apply normalization until you cannot decompose the

    relations further. State the reasons behind eachdecomposition.