Presentation is loading. Please wait.

Presentation is loading. Please wait.

Normalization Copyright © 1999 Patrick McDermott College of Alameda

Similar presentations


Presentation on theme: "Normalization Copyright © 1999 Patrick McDermott College of Alameda"— Presentation transcript:

1 Normalization Copyright © 1999 Patrick McDermott College of Alameda pmcdermott@peralta.edu

2 Eliminate the Redundancy The “Who Cares?” Test Ben Franklin, DBA John McCoy Hatter Fine Hats Made and Sold Redundant & Superfluous

3 For Each and Every Not Redundant At the Right level Passes The “Who Cares?” Test Usual goal is 3NF, though there are others –BCNF: Boyce/Codd NF –4NF –5NF I Saw the Figure 5 in Gold Charles Demuth c. 1928

4 Functional Dependencies If you know Key x, you can determine attribute Y x  Y

5 1NF (First Normal Form ) 2NF (Second Normal Form 3NF (Third Normal Form BCNF (Boyce-Codd NF) 4NF (Fourth Normal Form) 5NF (Fifth Normal Form) Normal Forms

6 Primary Key Unique –At any time –Across Time –Forever & Always Always –Mandatory –Even if optional, it’s mandatory. –You never want anything important hidden!

7 1NF 1. Reduce entities to first normal form (1NF) by removing repeating or multivalued attributes to another, child entity. First normal form (1NF) requires that each entity have a fixed number of attributes, each with a unique meaning and name. You achieve first normal form in by removing to a child entity any repeating or multivalued attributes, thereby organizing the data as “flat” structures.

8 2NF 2. Reduce 1NF entities to second normal form (2NF) by removing attributes that are not dependent on the whole primary key. Second normal form (2NF) requires that each nonkey attribute in a first normal form entity depend on the entire primary key. You achieve second normal form by removing to a parent entity any attributes dependent on only a subset of the primary key.

9 Trivial 2NF If all the columns in the table are part or the key It has a single column primary key Can add a synthetic key to get to 2NF BUT there will be a transitive dependency, you’ll need to get rid of for 3NF

10 3NF 3. Reduce 2NF entities to third normal form (3NF) by removing to a parent entity attributes that depend on other, nonkey attributes. Third normal form (3NF) requires that each nonkey attribute within a second normal form entity depend on the entire primary key and nothing other than the primary (and alternate) keys. You achieve third normal form by removing to a parent entity any attributes exhibiting transitive dependencies (i.e., nonkey attributes that depend on other nonkey attributes, where these other attributes are not alternate keys).

11 1NF-3NF First NF: Each item is Atomic –No Repeating Fields Second NF: In 1NF and Each item relates to the Key Third NF: In 2NF and No item is a fact about another item The Key The whole Key And nothing but the Key So help me Codd

12 Fog Warning “In nearly all logical data models, reaching third normal form is sufficient and is equivalent to reaching Boyce/Codd normal form, fourth normal form, and fifth normal form. Thus, if you are confused about levels beyond third normal form, do not worry! The highest three levels are minutely more desirable and need be attempted only by the advanced design analyst.” —Fleming & von Halle, Handbook of Relational Database Design The Fog Warning Winslow Homer c. 1885

13 BCNF 3½ Reduce 3NF entities to Boyce/Codd normal form (BCNF) by ensuring that they are in 3NF for any feasible choice of candidate key as primary key. Boyce/Codd normal form (BCNF) requires that all attributes depend on only the full candidate keys (primary and alternate keys) and do not depend on any subset of a candidate key. You achieve Boyce/Codd normal form by assuring that an entity is in third normal form for any feasible choice of candidate key as primary key. (For many logical data models, third normal form is equivalent to Boyce/Codd normal form.)

14 4NF 4. Reduce BCNF entities to fourth normal form (4NF) by removing any independently multivalued components of the primary key to two new parent entities. Retain the original (now child) entity only if it contains other, nonkey attributes. Fourth normal form (4NF) requires that the primary key of a third normal form entity contain no independently multivalued attributes. You achieve fourth normal form by removing any pair of such attributes to two new parent entities. (Many data analysts attain fourth normal form instinctively in the process of achieving third normal form.)

15 5NF— a.k.a Projection/Join PJNF 5. Reduce 4NF entities to fifth normal form (5NF) by removing pairwise cyclic dependencies (appearing within composite primary keys with three or more component attributes) to three or more new parent entities. Fifth normal form (5NF) requires that the primary key of a fourth normal form entity contain no pairwise cyclic redundancies. A cyclic redundancy occurs in a composite primary key of three or more attributes (A, B, C) if whenever entity occurrences (A1, B1, C2), (A2, B1, C1) and (A1, B2, C1) occur, then (A1, B1, C1) also is present.


Download ppt "Normalization Copyright © 1999 Patrick McDermott College of Alameda"

Similar presentations


Ads by Google