Download presentation

Presentation is loading. Please wait.

Published byDiane Foulk Modified over 2 years ago

1
Announcements Read 6.1 – 6.3 for Wednesday Project Step 3, due now Homework 5, due Friday 10/22 Project Step 4, due Monday Research paper –List of sources - due 10/29

2
Normalization Lecture 14

3
Algorithmic Test for Lossless Join Given a relation R(A1, A2, …, An), a set of functional dependencies, F, and a decomposition of R into relations R1, R2, …, Rm 1.Construct an m by n table S, with a column for each of the n attributes in R and a row for each of the m relations in the decomposition 2.For each cell S(i,j) of S, If the attribute for the column, Aj, is in the relation for the row, Ri, then place the symbol a(j) in the cell; else place the symbol b(i,j) there

4
Algorithmic Test for Lossless Join (Continued) 3.Repeat the following process until no more changes can be made to S: For each FD X → Y in F For all rows in S that have the same symbols in the columns corresponding to the attributes of X, make the symbols for the columns that represent the attributes of Y equal by the following rule: if any row has an a value, a(j), then set the value of that column in all other rows equal to a(j) if no row has an a value, then pick any one of the b values, say b(i,j), and all the other rows equal to b(i,j) 4.If, after all possible changes have been made to S, a row is made up entirely of a symbols, a(1), a(2), …, a(n), then the join is lossless. It there is no such row, the join is lossy.

5
R = {SSN, ENAME, PNUMBER, PNAME, PLOCATION, HOURS} R1 = EMP_LOCS={ENAME, PLOCATION} R2 = EMP_PROJ1={SSN, PNUMBER, HOURS, PNAME, PLOCATION} F={SSN→ENAME; PNUMBER→{PNAME, PLOCATION}; {SNN, PNUMBER}→HOURS SSNENAMEPNUMBERPNAMEPLOCATIONHOURS R1 R2

6
R = {SSN, ENAME, PNUMBER, PNAME, PLOCATION, HOURS} R1 = EMP={SSN, ENAME} R2 = PROJ={PNUMBER, PNAME, PLOCATION} R3 = WORKS_ON={SSN, PNUMBER, HOURS} F={SSN→ENAME; PNUMBER→{PNAME, PLOCATION}; {SNN, PNUMBER}→HOURS SSNENAMEPNUMBERPNAMEPLOCATIONHOURS R1 R2 R3

7
Lossless Projections Lossless property guaranteed if for each pair of relations that will be joined, the set of common attributes is a superkey of one of the relations Binary decomposition of R into {R 1,R 2 } has the lossless join property with respect to a set of functional dependencies F on R iff one of these holds The FD ((R1 ∩ R2) → (R1 - R2)) is in F + or The FD (( R1 ∩ R2) → (R2 - R1 )) is in F + If projection is done by successive binary projections, can apply binary decomposition test repeatedly

8
Multi-valued Dependency In R(A,B,C) if each A values has associated with it a set of B values and a set of C values such that the B and C values are independent of each other, then Multi-valued dependencies Example: JointAppoint(facId, dept, committee) assuming a faculty member can belong to more than one department and belong to more than one committee

9
4NF A table is 4NF if Example: remove MVDs in JointAppoint

10
5NF and DKNF A relation is 5NF A relation is in Domain-Key Normal Form (DKNF)

11
De-normalization When to stop the normalization process –

12
Inference Rules for FDs Armstrong’s Axioms –Reflexivity –Augmentation –Transitivity Additional rules that follow: –Additivity –Projectivity –Pseudotransitivity

13
Closure of Set of FDs If F is a set of functional dependencies for a relation R, then the set of all functional dependencies that can be derived from F, F +, is called the closure of F Could compute closure by applying Armstrong’s Axioms repeatedly

14
Closure of an Attribute If A is an attribute or set of attributes of relation R, all the attributes in R that are functionally dependent on A in R form the closure of A, A + Computed by Closure Algorithm for A, Section 5.7.3 result ← A; while (result changes) do for each functional dependency B → C in F if B is contained in result then result ← result C; end; A + ← result;

16
Uses of Attribute Closure Can determine if A is a superkey- Can determine whether a given FD X→Y is in the closure of the set of FDs. (Find X +, see if it includes Y)

17
Redundant FDs Given a set of FDs, can determine if any of them is redundant, i.e. can be derived from the remaining FDs, by a simple algorithm

18
Algorithm for Determining Redundancy 1.Choose a candidate FD, say X → Y, and remove it from the set of FDs 2.result ← X; while (result changes and Y is not contained in result) do for each FD, A → B, remaining in the reduced set of FDs If A is a subset of result, then result ← result B end 3.if Y is a subset of result, then the FD X → Y is redundant

20
Covers If a relation R has two sets of FDs, F and G –then F is a cover for G if every FD in G is also in F + –F and G are equivalent if F is a cover for G and G is a cover for F (i.e. F + = G + )

21
Minimal Set of FDs Set of FDs, F is minimal if –

22
Minimal Cover for Set of FDs A minimal cover for a set of FDs is a cover such that no proper subset of itself is also a cover A set of FDs may have several minimal covers

23
Algorithm for Finding Minimal Cover 1.Set F ← G 2.For each FD in F that is not in canonical form, i.e. of the form X → {Y1, Y2, …, Yn}, replace if by the n FDs X → Y1, X → Y2, …, X → Yn; 3.Eliminate extraneous attributed: For each FD X → Y in F for each attribute A that is an element of X if ((F-{X → Y}) U {(X – {A}) → Y} is equivalent to F then replace X → Y with (X – {A}) → Y in F; 4.Eliminate redundant FDs: For each remaining FD X → Y in F if (F – {X → Y}) is equivalent to F then remove X → Y from F

25
Decomposition Algorithm for BCNF Can always find a lossless decomposition that is BCNF –Find a FD that is a violation of BCNF and remove it by decomposition process –Repeat this process until all violations are removed No need to go through 1NF, 2NF, 3NF process Not always possible to preserve all FDs

26
Synthesis Algorithm for 3NF Can always find 3NF decomposition that is lossless and that preserves all FDs 3NF Algorithm uses synthesis –Begin with universal relation and set of FDs,G –Find a minimal cover for G –Combine FDs that have the same determinant –Include a relation with a key of R –Algorithm in the book, p. 260

Similar presentations

OK

Normal Forms Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems June 18, 2016 Some slide content courtesy of Susan Davidson.

Normal Forms Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems June 18, 2016 Some slide content courtesy of Susan Davidson.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Business plan ppt on event management Ppt on network switching table Ppt on kingdom monera species Ppt on anti cancer therapy journal Product mix ppt on nestle promotion Ppt on latest technology in mechanical engineering Free download ppt on chemical bonding Download ppt on work life and leisure Ppt on hiroshima and nagasaki attacks Ppt on south african culture for kids