Suppose that we have entity sets Parts, Suppliers, and Departments, as well as a relationship set Contracts that involves all of them. We refer to the schema for Contracts as CQPSD . A contract with contract id
C species that a supplier S will supply some quantity Q of a part P to a department D .
We might have a policy that a department purchases at most one part from any given supplier.
Thus, if there are several contracts between the same supplier and department,
we know that the same part must be involved in all of them. This constraint is an FD, DS ! P .
Returning to the issue of schema refinement, the first question to ask is whether any refinement is needed!
If a relation is in a certain normal form (BCNF, 3NF etc.), it is known that certain kinds of problems are avoided/minimized. This can be used to help us decide whether decomposing the relation will help.
Role of FDs in detecting redundancy:
Consider a relation R with 3 attributes, ABC.
No FDs hold: There is no redundancy here.
Given A B: Several tuples could have the same A value, and if so, they’ll all have the same B value!
Minimality of a key is crucial in third condition above!
If R is in BCNF, obviously in 3NF.
If R is in 3NF, some redundancy is possible. It is a compromise, used when BCNF not achievable (e.g., no ``good’’ decomp, or performance considerations).
Lossless-join, dependency-preserving decomposition of R into a collection of 3NF relations always possible.
Second FD causes violation of 3NF; W values repeatedly associated with R values. Easiest way to fix this is to create a relation RW to store these associations, and to remove W from the main schema:
i.e., we decompose SNLRWH into SNLRH and RW
The information to be stored consists of SNLRWH tuples. If we just store the projections of these tuples onto SNLRH and RW, are there any potential problems that we should be aware of?
If R is decomposed into X, Y and Z, and we enforce the FDs that hold on X, on Y and on Z, then all FDs that were given to hold on R must also hold. (Avoids Problem (3).)
Projection of set of FDs F : If R is decomposed into X, ... projection of F onto X (denoted F X ) is the set of FDs U V in F + ( closure of F ) such that U, V are in X.
Decomposition of R into X and Y is dependency preserving if (F X union F Y ) + = F +
i.e., if we consider only dependencies in the closure F + that can be checked in X without considering Y, and in Y without considering X, these imply all dependencies in F + .
Important to consider F + , not F , in this definition:
ABC, A B, B C, C A, decomposed into AB and BC.
Is this dependency preserving? Is C A preserved?????
Dependency preserving does not imply lossless join:
The previous example illustrated how FDs can help to rene the subjective decisions made during ER design,
but one could argue that the best possible ER diagram would have led to the same nal set of relations.
Our next example shows how FD information can lead to a set of relations that eliminates some redundancy problems and is unlikely to be arrived at solely through ER design.
The relation schema CTB is in BCNF; thus we would not consider decomposing it further if we looked only at the FDs that hold over CTB .
There is redundancy. The fact that Green can teach Physics101 is recorded once per recommended text for the course. Similarly, the fact that Optics is a text for Physics101 is recorded once per potential teacher.
The redundancy can be eliminated by decomposing CTB into CT and CB .
Let R be a relation schema and let X and Y be subsets of the attributes of R . Intuitively,
the multivalued dependency X !! Y is said to hold over R if, in every legal
The redundancy in this example is due to the constraint that the texts for a course are independent of the instructors, which cannot be epressed in terms of FDs.
This constraint is an example of a multivalued dependency , or MVD. Ideally, we should model this situation using two binary relationship sets, Instructors with attributes CT and Text with attributes CB .
Because these are two essentially independent relationships, modeling them with a single ternary relationship set with attributes CTB is inappropriate.
A join dependency is a further generalization of MVDs. A join dependency (JD) ∞{ R 1,….. Rn } is said to hold over a relation R if R 1 ,…. Rn is a lossless-join decomposition of R .
An MVD X ->-> Y over a relation R can be expressed as the join dependency ∞ { XY,X(R − Y) }
As an example, in the CTB relation, the MVD C ->->T can be expressed as the join dependency ∞{ CT, CB }
Unlike FDs and MVDs, there is no set of sound and complete inference rules for JDs.
A relation schema R is said to be in fth normal form (5NF) if for every JD ∞{ R 1,…. Rn } that holds over R , one of the following statements is true:
Ri = R for some i , or
The JD is implied by the set of those FDs over R in which the left side is a key for R .
The following result, also due to Date and Fagin, identies conditions|again, detected using only FD information|under which we can safely ignore JD information.
If a relation schema is in 3NF and each of its keys consists of a single attribute,it is also in 5NF.
Be the first to comment