Functional Dependencies Examples
Functional Dependencies Examples
Example
Since for each value of A there is associated one and only one value of B.
Example
Dependency Diagrams
A dependency diagram consists of the attribute names and all functional dependencies in a
given table. The dependency diagram of Supplier table is.
Here Y is FD on X, but X has two proper subsets Sno and Status; city is· FD .on one proper
subset .of X i.e. Sno
Sno City
According to 'FFD definition Y must not be FD .on any proper subset of X, but here City is FD in
one subset .of X i.e. Sno, so City is not FFD on (Sno, Status)
Consider another case of SP table:
Here, Qty is FD on combination of Sna, Pno.
(Sno, Pno) Qty
X Y
Here, X has two proper subsets Sno and Pna
Qty is not FD on Sno, because one Sna can supply mare than .one quantity.
Qty is also not FD on Pno, because .one Pna may be supplied many times by different suppliers
with different .or same quantities.
So, Qty is FFD and composite attribute of (Sno, Pno) à Qty.
Other Functional Dependencies
There are same rather types of functional dependencies, which play a vital rule during the
process .of normalization of data.
Candidate Functional Dependency
A candidate functional dependency is a functional dependency that includes all attributes of the
table. It should also be noted that a well-fanned dependency diagram must have at least one
candidate functional dependency, and that there can be more than .one candidate functional
dependency for a given dependency diagram.
Primary Functional Dependency
A primary functional dependency is a candidate functional dependency that is selected to
determine the primary key. The determinant of the primary functional dependency is the primary
key of the relational database table. Each dependency diagram must have one and only on
primary functional dependency. If a relational database table has .only .one candidate functional
dependency, then it automatically becomes the primary functional dependency
Once the primary key has been determined, there will be three possible types of functional
dependencies:
Description
A à B A key attribute functionally determines a non-key attribute.
A à B A non-key attribute functionally determines a non-key attribute.
A à B A non-key attribute functionally determines a key attribute.
A partial functional dependency is a functional dependency where the determinant consists of
key attributes, but not the entire primary key, and the determined consist~ of non-key attributes.
A transitive functional dependency is a functional dependency where the determinant
consists of non-key attributes and the determined also consists of non-key attributes.
A Boyce-Codd functional dependency is a functional dependency where the determinant
consists of non-key attributes and the determined consists of key attributes.
A Multi-Value Dependency (MVD) occurs when two or more independent multi valued facts
about the same attribute occur within the same table. It means that if in a relation R having A,
Band C as attributes, B and Care multi-value facts about A, which is represented as A ààB and
A ààC ,then multi value dependency exist only if B and C are independent on each other.
A Join Dependency exists if a relation R is equal to the join of the projections X Z. where X, Y,
Z projections of R.
Closure of set of dependencies
Let a relation R have some functional dependencies F specified. The closure of F (usually
written as F+) is the set of all functional dependencies that may be logically derived
from F. Often F is the set of most obvious and important functional dependencies and. F+, the
closure, is the set of all the functional dependencies including F and those that can be deduced
from F. The closure is important and may, for example, be needed in finding one or more
candidate keys of the relation.
For example, the student relation has the following functional dependencies
sno Sname
cno came
sno address
cno instructor
Instructor office
Let these dependencies be denoted by F. The closure of F, denoted by F +, includes F and all
functional- dependencies that are implied by F.
To determine F+, we need rules for deriving all functional dependencies that are implied: by F. A
set of rules that may be used to infer additional dependencies was proposed by Armstrong in
1974. These rules (or axioms) are a complete set of rules in· that all possiblefunctional
dependencies may be derived from them. The rules are:
1. Reflexivity Rule - If X is a set of attributes and Y is a subset of X, then X àY holds.
The reflexivity rule is the simplest (almost trivial) rule. It states that each subset of X is
functionally dependent on X. In other words trivial dependence is defined as follows:
Trivial functional dependency: A trivial functional dependency is a functional dependency of
an attribute on a superset of itself.
For example: {Employee ID, Employee Address} à {Employee Address} is trivial, here
{Employee Address} is a subset of {Employee ID, Employee Address}.
2. Augmentation Rule - If X à Y holds and W is a set of attributes, and then WX à WY holds.
The argumentation ('u rule is also quite simple. It states that if Y is determined by X then a set of
attributes W and Y together will be determined by W and X together. Note that we use the
notation WX to mean the collection of all attributes in W and X and write WX rather than the
more conventional (W, X) for convenience.
For example: Rno - Name; Class and Marks is a set of attributes and act as
W. Then· {Rno, Class, Marks} -> {Name, Class, Marks}
3. Transitivity Rule - If X -> Y and Y -> Z hold, then X -> Z holds.
The transitivity rule is perhaps the most important one. It states that if X functionally determines
Y and Y functionally determine Z then X functionally determines Z.
For example: Rno -> City and City -> Status, then Rno -> Status should be holding true.
These rules are called Armstrong's Axioms.
Further axioms may be derived from the above although the above three axioms are sound and
complete in that they do not generate any incorrect functional dependencies (soundness) and
they do generate all possible functional dependencies that can be inferred
from F (completeness). The most important additional axioms are:
In discussing the concept of equivalent FDs, it is useful to define the concept of minimal
functional dependencies or minimal cover which is useful in eliminating necessary
functional dependencies so that only the minimal numbers of dependencies need to be enforced
by thesystem. The concept of minimal cover of F is sometimes called irreducible Set of F.
A functional depending set S is irreducible if the set has three following properties:
Each right set of a functional dependency of S contains only one attribute.
Each left set of a functional dependency of S is irreducible. It means that reducing anyone
attribute from left set will change the content of S (S will lose some information).
Reducing any functional dependency will change the content of S.
Sets of functional dependencies with these properties are also called canonical or minimal.