Relational Database Design Algorithms and Further Dependencies

Chapter Outline

0. Designing a Set of Relations 1. Properties of Relational Decompositions 2. Algorithms for Relational Database Schema 3. Multivalued Dependencies and Fourth Normal Form 4. Join Dependencies and Fifth Normal Form 5. Inclusion Dependencies 6. Other Dependencies and Normal Forms

DESIGNING A SET OF RELATIONS

Goals:

Lossless join property (a must)

Algorithm 11.1 tests for general losslessness. Algorithm 11.3 decomposes a relation into BCNF components by sacrificing the dependency preservation. 4NF (based on multi-valued dependencies) 5NF (based on join dependencies)

Dependency preservation property

Additional normal forms

1. Properties of Relational Decompositions

Relation Decomposition and Insufficiency of Normal Forms: Universal Relation Schema:

A relation schema R = {A1, A2, …, An} that includes all the attributes of the database. Every attribute name is unique.

Universal relation assumption:

(Cont)

Decomposition:

Attribute preservation condition:

The process of decomposing the universal relation schema R into a set of relation schemas D = {R1,R2, …, Rm} that will become the relational database schema by using the functional dependencies. Each attribute in R will appear in at least one relation schema Ri in the decomposition so that no attributes are “lost”.

(Cont)

Another goal of decomposition is to have each individual relation Ri in the decomposition D be in BCNF or 3NF. Additional properties of decomposition are needed to prevent from generating spurious tuples

(Cont)

Dependency Preservation Property of a Decomposition:

Definition: Given a set of dependencies F on R, the projection of F on Ri, denoted by pRi(F) where Ri is a subset of R, is the set of dependencies X → Y in F+ such that the attributes in X U Y are all contained in Ri. Hence, the projection of F on each relation schema Ri in the decomposition D is the set of functional dependencies in F+, the closure of F, such that all their left- and right-hand-side attributes are in Ri.

(Cont.)

Dependency Preservation Property of a Decomposition (cont.):

Dependency Preservation Property:

A decomposition D = {R1, R2, ..., Rm} of R is dependency-preserving with respect to F if the union of the projections of F on each Ri in D is equivalent to F; that is ((πR1(F)) U . . . U (πRm(F)))+ = F+ (See examples in Fig 10.12a and Fig 10.11)

Claim 1:

It is always possible to find a dependency-preserving decomposition D with respect to F such that each relation Ri in D is in 3NF.

Projection of F on Ri

Given a set of dependencies F on R, the projection of F on Ri, denoted by πRi(F) where Ri is a subset of R, is the set of dependencies X → Y in F+ such that the attributes in X ∪ Y are all contained in Ri.

Dependency Preservation Condition

Given R(A, B, C, D) and F = { A → B, B → C, C → D} Let D1={R1(A,B), R2(B,C), R3(C,D)} πR1(F)={A → B} πR2(F)={B → C} πR3(F)={C → D} FDs are preserved.

(Cont.)

Lossless (Non-additive) Join Property of a Decomposition:

Definition: Lossless join property: a decomposition D = {R1, R2, ..., Rm} of R has the lossless (nonadditive) join property with respect to the set of dependencies F on R if, for every relation state r of R that satisfies F, the following holds, where * is the natural join of all the relations in D:

* (π R1(r), ..., πRm(r)) = r

Note: The word loss in lossless refers to loss of information, not to loss of tuples. In fact, for “loss of information” a better term is “addition of spurious information”

Example

S s1 s2 s3 P p1 p2 p1 D d1 d2 d3 = S s1 s2 s3 P p1 p2 p1 * P p1 p2 p1 D d1 d2 d3

Lossless Join Decomposition ?? NO

(Cont.)

Lossless (Non-additive) Join Property of a Decomposition (cont.):...