Functional Dependency and Decomposition
Functional Dependency and Decomposition
SYSTEM
Dr. Mageshwari V
Assistant Professor
Department of Mathematics
Amrita Vishwa Vidyapeetham
F U N C T I O NA L
D E P E N DA N C Y &
DECOMPOSITION
1
F U N C T I O N A L D E P E N DA N C Y &
DECOMPOSITION
other
attribute is called the determined.
For each value of the determinant there is associated one
and
only one value of the determined.
If A is the determinant and B is the determined then we say that A
4
functionally determines B and graphically represent this as
A -> B. can also be expressed as B is functionally determined by A.
Since for each value of A there
is associated one and only one
value of B.
5
Since for A = 3 there is associated
more than one value of B.
Functional dependency can also
be defined as follows:
An attribute in a relational model
is said to be functionally
dependent on another attribute
in the table if it can take only one
value for a given value of the
attribute upon which it is
functionally dependent.
6
FU N C TI O NA L D E P E N D E N C Y DIAGRAM AND
EXAMPLES
7
Here in Supplier table
dependent on Sno.
Similarly, city and status are also F D on Sno, because for each
Pno -> Wt
11
The F D diagram of relation
Shipment is shown in diagram.
Here following functional
12
F U L LY F U N C T I O N D E P E N D E N C Y (FDD)
The term full functional dependency (FFD) is used to indicate the
minimum set of attributes in of a functional dependency (FD).
In other words, the set of attributes X will be full functionally
dependent on the set of attributes Y if the following conditions
are satisfied:
X is functionally dependent on Y and
X is not functionally dependent on any subset of Y.
Example:
Let R be
Student(stuId, Name, branch)
FDs in R include
16
NON-TRIVIAL DE P E NDE NCY
An employee table with three attributes: emp_id, emp_name,
emp_address.
The following functional dependencies are non-trivial:
emp_id -> emp_name (emp_name is not a subset of emp_id)
emp_id -> emp_address (emp_address is not a subset of
emp_id)
On the other hand, the following dependencies are trivial:
17
ARMSTRONG’S AXIOMS(RULES) FOR
FUNCTIONAL D E P E N D E N C I E S
Armstrong's Axioms is a set of rules.
It provides a simple technique for reasoning about functional
dependencies.
It was developed by William W. Armstrong in 1974.
18
PRIMARY RULES
Rule 1----------Reflexivity
If A is a set of attributes and B is a subset of A, then A holds B.
{A → B }
Rule 2-------Augmentation
If A->B, then AC->B and A C → B C
It means that attribute in dependencies does not change the basic
dependencies.
Rule 3--------Transitivity
If A holds B and B holds C , then A holds C .
algorithm.
Example
F = {A → B , C → D, B D → E , A C → E}
1. Find out whether a F D f: A C → E is redundant or not.
Step-3: T = A C + B = AC B # A → B is in F’ and A ⊆T
T = ACB+D=ACB D # C → D is in F’ and C ⊆
T
T = AC B + E = AC B D E # A C → E is in F’ and A C
⊆T 21
Step-4: f: A C → E is redundant. #E ⊆T
2. Find out whether a F D f: B D → E is redundant or not.
A closure of a set of FDs is a set of all possible FDs that can be derived
from a given set of FDs. It is also referred as a complete set of FDs.
If F is used to denote the set of FDs for relation R , then a closure of a set
of FDs implied by F is denoted by F + .
Example
}
Determine each set of attributes X that appears as a left-hand side of F D
in F. { cid, ano } and ano.
Find out { cid, ano }+
Step-1 : { cid, ano }+ = { cid, ano }
Step-2 : { cid, ano }+ = { cid, ano, acess_date } # {cid, ano} ⊆ X +
{ cid, ano }+ = { cid, ano, acess_date, balance, bname } # ano ⊆ X +
Step-3: { cid, ano }+ = { cid, ano, acess_date, balance, bname }
26
DECOMPOSITION
A decomposition of a relation can be either lossy decomposition or
lossless join decomposition.
⚫ Lossy Decomposition
⚫ Lossless J o i n Decomposition
27
L O S SY DECOMPOSITION
30
31
DEPENDENCY- P R E SE RVI N G
DECOMPOSITION
When any relation is decomposed, illegal relations should not be
created. A relation is an illegal relation, if it does not preserve
given functional dependencies.
31
Thus, the decomposition is dependency preserving decomposition.
32