chapter 13 further normalization ii: higher normal forms

14
Chapter 13 Further Normalization II: Higher Normal Forms

Upload: rosamond-goodwin

Post on 31-Dec-2015

217 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Chapter 13 Further Normalization II: Higher Normal Forms

Chapter 13

Further Normalization II: Higher Normal Forms

Page 2: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-2

Topics in this Chapter

• Multi-Valued Dependencies and Fourth Normal Form

• Join Dependencies and Fifth Normal Form• The Normalization Procedure Summarized• A Note on Denormalization• Orthogonal Design• Other Normal Forms

Page 3: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-3

Multi-Valued Dependencies and Fourth Normal Form

• A multi-valued dependency occurs when a determinant determines more than one dependent, and the dependents are independent of each other

• Ex.: course implies teacher; course implies text, where teacher and text are independent

• A relvar with course, teacher and text is all key, and exhibits redundancy, but is in 3NF

• Updates can exhibit anomalies

Page 4: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-4

Fourth Normal Form

• Relvar R is in 4 NF if and only if, whenever there exist subsets A and B of the attributes of R such that the nontrivial multi-valued dependency A multi-determines B is satisfied, then all attributes of R are also functionally dependent on A

• In the previous example, decompose course, teacher, text into two relvars: course teacher, and course text

Page 5: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-5

Join Dependencies and Fifth Normal Form

• There exist relvars that cannot be nonloss-decomposed into two relvars, but can be nonloss-decomposed into more than two

• Ex.: supplier, part, project• A supplier supplies parts and projects, a

project is supplied by suppliers and parts, but from this you may not validly conclude that a particular supplier supplies a particular part to a particular project

Page 6: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-6

Join Dependency

• Let R be a relvar, and let A, B, … Z be subsets of the attributes of R. Then we say that R satisfies the JD

* ( A, B, …. Z )

if and only if every legal value of R is equal to the join of its projections on A, B, … Z

• Supplier, part, project can be said to satisfy this only if an additional constraint is included to make the specific conclusion valid

Page 7: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-7

Fifth Normal Form

• A relvar R is in 5NF – also called projection-join normal form, if and only if every nontrivial join dependency that is satisfied by R is implied by the candidate key(s) of R

• In the general case, SPJ is not in 5NF, but SP, PJ, and JS are in 5NF

• 5NF is a generalization of 4NF, which is a generalization of 3NF

• It is the most general form possible for projection-based normalization

Page 8: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-8

The Normalization Procedure Summarized

• Begin with a relvar in 1NF• Take projections to eliminate FDs that are not

irreducible; result is in 2NF• Take projections to eliminate transitive FDs;

result is in 3NF• Take projections to eliminate FDs in which

the determinant is not a candidate key; result is BCNF

• Continue on next slide

Page 9: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-9

The Normalization Procedure Continued

• Using a relvar in BCNF, take projections to eliminate MVDs that are not also FDs

• In practice it is unlikely that you will need to do this, because you will have eliminated independent relation valued attributes before you began

• Take projections of 4NF relvars to eliminate JDs that are not implied by the candidate keys, if you can find any

Page 10: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-10

Normalization Steps

• By definition 5NF is the final normal form for decompositions based on projection

• All anomalies are a result of FDs or MVDs or JDs that are not implied by the candidate keys

• Mathematical relations are complete in 1NF; successive steps are needed because database relations are semantic: they are based on the real world meaning of the data

• If you design well from the top, the design will be normalized from the beginning

Page 11: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-11

A Note on Denormalization

• Denormalization is said to be necessary to improve performance

• Technically normalization is a model concept, not related to stored files

• Most people confuse the two, as a shorthand• In practice, denormalization will speed up

some queries, and drag down others• Proceed with caution

Page 12: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-12

Orthogonal Design

• Within a given database, no two distinct base relvars should have overlapping meanings

• Let A and B be distinct base relvars. Then there must not exist nonloss decompositions of A and B into A1, A2 …, Am and B1, B2, …, Bn such that some projection of Ai in the set A1, A2, …, Am and some projection of Bj in the set B1, B2, …, Bn have overlapping meanings

• Base relvars should have mutually independent meanings

Page 13: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-13

Other Normal Forms

• Additional normal forms arise in the analysis of dependency theory

• Domain-key normal form (DK/NF) is not defined in terms of FDs, MVDs, or JDs

• A relvar R is in DK/NF if and only if every constraint on R is a logical consequence of the domain constraints and key constraints that apply to R

Page 14: Chapter 13 Further Normalization II: Higher Normal Forms

Copyright © 2004 Pearson Addison-Wesley. All rights reserved. 13-14

Yet More Normal Forms

• Restriction-union normal form applies when we segment the relvar horizontally, i.e. via restriction rather than projection

• Sixth normal form represents a generalization of join dependency, which would require a generalization of the projection and join operators

• By definition, a relvar in 6NF is in 5NF• Further research on dependency theory is

underway