Beruflich Dokumente
Kultur Dokumente
FD’s:
Second Normal Form (2NF)
Definition:
A relation is in second normal form (2NF) if and only if it
in 1NF and all nonkey attributes are fully dependent on
the key.
FD’s:
2NF
• Instance of the previous relations.
Example:
Objectives of 2NF:
• FD’s:
• The STUID functionally determines STATUS in two
ways: Directly and Transitively through CREDITS.
• Example:
3NF
Example:
Constrains:
1. No two faculty members within a single department have the
same name.
2. Each faculty member have only one office.
3. A department may have several faculty offices.
4. Faculty members from the same department may share
offices.
Resulting FDs:
- 2NF?
- 3NF?
BOYCE-CODD Normal form (BCNF)
Definition:
A relation is in Boyce-Codd normal form (BCNF) if
and only if
- every determinant is a candidate key
Semantics:
1. Each project has unique name but names of
employees and managers are not unique.
2. Each project has one manager whose name is stored
in PROJMGR.
Semantics:
NORMAL FORMS:
1NF? With our composite key, which cell will be single value so
WORK is 1NF.
2NF? NO because we have the following partial dependency.
We transform the relation into an equivalent set of 2NF
relations by projection,resulting:
3NF?
PROJ and WORK1 are in 3NF but EMP is not because
we have a transitive dependency:
BCNF?
Yes since in each relation the only determinant is the
primary key.
The Normalization Process
• The process of finding stable set of relations that is a
faithful model of the enterprise.
Improve Algorithm:
1. Make a list of all FDs.
2. Eliminate extraneous attributes in each FD.
3. Remove any redundant FDs and find a non
redundant covering of the input FDs.
- Combine FD groups with equivalent key.
4. Group together those with the same determinant.
5. Construct a relation for each group.
Example: Consider the following set of FDs.
Assume that:
1. A faculty member can belong to more than one
department.
2. A faculty can belong to several college-wide
committees.
3. There is no relation between department and
committee.
Consider the following figure.
• The resulting relation is in BCNF but we still have update,
insertion, deletion anomalies, i.e.
– Update a committee that F101 belongs from Budget to Advancement.
• The faculty is not associated with only one department, is
associated with a particular set of departments and a particular
set of committees that are independent of each other.
– This independence is the cause of the problem.
Definition:
4NF
Objectives of 4NF:
• The semantics are more explicit:
- all dependencies are related.
• Database designed with 4NF relations avoid undesirable
update anomalies present in 3NF.
- In the previous example: We cannot drop a faculty member
from a committee without loosing information about the
faculty( assuming he belongs to only one committee).
• The schema of a BCNF relation gives no glue to whether
there are multivalued dependencies among the primary
key’s components not is it clear which components of the
primary key are independent of one another.
- Knowing that a relation is in 4NF means that no
component of the key is independent of any other
component.
Lossless Decomposition
Definition:
A decomposition of a relation R is a set of relations
{R1, R2, …, Rn} such that:
- each Ri is a subset of R ( Ri R )
- the union of the Ri is R ( Ri = R )
Steps:
1. Constuct an m by n table S, with a column for each of the n
attributes in R and 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
set S(i,j) = a(j)
else set S(i,j) = b(i,j)