Part 2
Part 2
Each of the smaller relations contains a subset of the attributes of the original relation.
We refer to this process as decomposition of the larger relation into the smaller relations
lose information
Ensuring all functional dependencies are preserved in decomposed tables can be challenging
PROPERTIES OF DECOMPOSITION
Following are the properties of Decomposition,
1. Lossless Decomposition
2. Dependency Preservation
Example:
Contracts(cid,sid,jid,did,pid,qty,value), and:
C is the key: C CSJDPQV
Project purchases each part using single contract: JP C
Dept purchases at most one part from a supplier: SD P
JP C, C CSJDPQV imply JP CSJDPQV
SD P implies SDJ JP
SDJ JP, JP CSJDPQV imply SDJ CSJDPQV
Example for producing a FD based on AA
Given a relation R with attributes W, U, V, X, Y, Z and
functional dependencies:
W UV, U Y, VX YZ. Prove that it holds: WX
Z.
Solution:
1. (with decomposition) From W U V we take W V.
2. (with augmentation) WX VX.
3. (with transitivity) WX YZ.
4. (with decomposition) WX Z.
2. ATTRIBUTE CLOSURE (AC)
The closure of a set of attributes X, denoted as X+, is the set of all
attributes that can be functionally determined by X.
It is used to find all attributes that are dependent on a given set of
attributes, which helps in identifying candidate keys and ensuring
the integrity of database design.
Example:
Given FDs: (AB.B-C,A-D)
Compute A+:
Start: A+={A}
Apply A->B: A+ = {A, B}
Apply B->C: A+= {A, B, C}
Apply A->D: A+= {A, B, C, D}
Result: A+={A, B, C, D}
Algorithm to find the Closure of a Set of attributes X
Given a relation R και its functional dependencies
F+, find the closure of attribute A.
1. Let X=A.
2. Among the functional Dependencies of F+, we
search for dependencies C D, where C ⊆ X. If
we found such a dependency, then we add D in X.
3. We repeat Step 2 till we cannot add additional
attributes in X.
Example 1
Let R= (V, Y, Z, W) and F+ = {V Z, VZ W, W Y, VY
W}
Find the closure of attribute V.
Solution:
Step 1: X=V.
Step 2: X=VZ because of V Z.
Step 3: X=VZW because of VZ W.
Step 3: X=VZWY because of W Y.
Step 3: No more repeats can be made.
Example 2
Let R = ( V, Y, Z, W) and F+ = {V Υ, W Y, V W}
Find the closure of attribute V.
Solution:
Step 1: X=V.
Step 2: X=VY because of V Y.
Step 3: X=VYW because of V W.
Step 3: no more repeats can be made.
Other Kinds of Dependencies (or) Types of Functional
Dependencies:
Fully -Functional dependency
Partial dependency
Transitive dependency
Trivial functional dependency
Non-trivial functional dependency
Multivalued dependency
Full Functional Dependency
A functional dependency X→Y is said to be a full functional dependency, if
removal of any attribute A from X, the dependency does not hold any more. i.e. Y
is fully functional dependent on X, if it is Functionally Dependent on X and not on
any of the proper subset of X.
For example, (Emp_num.Proj_num) → Hour
Is a full functional dependency. Here, Hour is the working time by an employee in
a project.
Partial Dependency
A functional dependency X →Y is said to be a partial functional dependency, if
after removal of any attribute A from X, the dependency still holds. i.e. Y is
dependent on a proper subset of X. So X is partially dependent on X.
For example,If (Emp mum, Proj_num) Emp_name but also Emp num→
Emp_name then Emp_name is partially functionally dependent on
(Empl_mmm,Proj_num).
a non-key attribute is determined by a part, but not the whole, of a COMPOSITE
primary key.
Transitive Dependency
A functional dependency is X → Z is said to be a transitive functional dependency if there
exists the functional dependencies X → Y and Y Z ie. it is an indirect relationship.
For example, EMP NUM JOB_CLASS is a transitive dependency which comes from
EMP_NUM JOB_CLASS and JOB_CLASS CHG_HOUR Trivial functional dependency
A functional dependency X → Y is said to be a trivial functional dependency if Y is a subset
of X.
For example, (Emp_num Emp_name) → Emp_num is a trivial functional dependency since
Transitive
Emp_num is a subset of (Emp_nunEmp_name).
Dependency
EMPLOYEE