Presentation is loading. Please wait.

Presentation is loading. Please wait.

Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.

Similar presentations


Presentation on theme: "Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D."— Presentation transcript:

1 Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.

2  Without normalization, problems with relations include:  Unnecessary redundancy  Insert anomalies  Update anomalies  Delete anomalies

3  Splitting a relation into two (more specific) relations is called decomposition  The objective is to have each resulting relation be atomic  i.e. each relation should contain only information related to the key

4  A given relation R with set F of functional dependencies is in BCNF if and only if all functional dependencies X  Y in F are:  either trivial (i.e. Y  X)  or X is a superkey of R  If relation R is not in BCNF, it is possible to use decomposition to transform R to BCNF

5  Given a set F of functional dependencies for relation R( A 1, A 2,..., A n ) that is not in BCNF:  Convert F to a minimal basis  Find an X  Y that violates BCNF  Compute closure X+  Decompose R into: ▪ R 1 containing all attributes of X+ ▪ R 2 containing { A 1, A 2,..., A n } – ( X+ – X )  Project functional dependencies onto R 1 and R 2 Repeat!

6  A decomposition of R into relations R 1, R 2,..., R n is considered lossless if for all possible instances of R, we are guaranteed that:  R 1 ⋈ R 2 ⋈... ⋈ R n = R  Note that the order of the natural joins is not important since ⋈ is both associative and symmetric

7  Decomposition (hopefully) achieves:  Elimination of anomalies: remove redundancy and update/insert/delete anomalies  Recoverability of information: can we recover the original relation from its decomposition?  Preservation of dependencies: can we reconstruct the original functional dependencies?

8  A given relation R with set F of functional dependencies is in 3NF if and only if all functional dependencies X  Y in F are:  trivial (i.e. Y  X)  or X is a superkey of R  or all attributes of Y are prime attributes  A prime attribute is an attribute that is a member of some key of relation R

9  Given a set F of functional dependencies for relation R( A 1, A 2,..., A n ) that is not in 3NF:  Convert F to a minimal basis  Combine all functional dependencies with the same left-hand side  Set D = { }  For each functional dependency X  Y in F: ▪ If there is no relation in D that contains all attributes in X and Y, then add a relation with attributes X  Y to D

10  If there are no relations in D that have all attributes of one of the keys of R, then add a new relation to D that contains all attributes in one of the keys of R  Simplify D by removing redundancy: ▪ if R 1 and R 2 are in D, but R 2 contains all attributes of R 1, then remove R 1

11  The 3NF decomposition algorithm guarantees the following:  The resulting relations are in 3NF  The decomposition is dependency preserving  The decomposition is lossless

12  Given relation R( A, B, C, D, E, F ) and functional dependencies AB  AC, CE  DB, B  A, and D  AE  What are the keys of R?  What are the superkeys of R that are not keys?  Is relation R in 3NF? If not, decompose R such that it is in 3NF


Download ppt "Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D."

Similar presentations


Ads by Google