Functional Dependency - Attribute Closure and Armstrong's Axioms
Functional Dependency - Attribute Closure and Armstrong's Axioms
A. Functional Dependency
• A functional dependency A->B in a relation holds if two tuples having same value of
attribute A also have same value for attribute B.
• For Example, in relation STUDENT shown in table 1, Functional Dependencies
STUD_NO->STUD_NAME, STUD_NO->STUD_PHONE hold
but
STUD_NAME->STUD_STATE do not hold
How to find functional dependencies for a relation?
Functional Dependencies in a relation are dependent on the domain of the relation. Consider the
STUDENT relation given in Table 1.
• Functional Dependency set or FD set of a relation is the set of all FDs present in the
relation.
• If attribute closure of an attribute set contains all attributes of relation, the attribute set will be super key of the
relation.
• If no subset of this attribute set can functionally determine all attributes of the relation, the set will be
candidate key as well.
• For Example, using FD set of table 1,
(STUD_NO, STUD_NAME)+ = {STUD_NO, STUD_NAME, STUD_PHONE, STUD_STATE,
STUD_COUNTRY, STUD_AGE}
(STUD_NO)+ = {STUD_NO, STUD_NAME, STUD_PHONE, STUD_STATE, STUD_COUNTRY,
STUD_AGE}
(STUD_NO, STUD_NAME)+ will be super key but not candidate key because its subset (STUD_NO)+ is
equal to all attributes of the relation. So, STUD_NO will be a candidate key.
Question: Consider the relation scheme R = {E, F, G, H, I, J, K, L, M, N} and the set of
functional dependencies {{E, F} -> {G}, {F} -> {I, J}, {E, H} -> {K, L}, K -> {M}, L -> {N}
on R. What is the key for R?
A. {E, F}
B. {E, F, H}
C. {E, F, H, K, L}
D. {E}
Question: In a schema with attributes A, B, C, D and E following set of functional dependencies are given
{A -> B, A -> C, CD -> E, B -> D, E -> A}
Which of the following functional dependencies is NOT implied by the above set?
A. CD -> AC
B. BD -> CD
C. BC -> CD
D. AC -> BC
Answer: Using FD set given in question,
(CD)+ = {CDEAB} which means CD -> AC also holds true.
(BD)+ = {BD} which means BD -> CD can’t hold true. So this FD is no implied in FD set. So (B) is the required
option.
Others can be checked in the same way.
Prime and non-prime attributes
• Attributes which are parts of any candidate key of relation are called as prime attribute,
others are non-prime attributes.
• For Example, STUD_NO in STUDENT relation is prime attribute, others are non-prime
attribute.
Cases of Functional dependencies
Fully Functional dependency (FFD)
• The set of attributes X will be fully functionally dependent on the set
of attributes Y if.
• X is functionally dependent on Y and
• X is not functionally dependent on any subset of Y
Trivial Functional Dependency
• A "dependent" in Trivial functional dependency is always a subset of
the "determinant".
• A functional dependency is said to be trivial if the attributes on its
right side are a subset of the attributes on its left side.
• If D is a subset of C, C→D is referred to as a Trivial Functional
Dependency.
• For example {Roll_No, S_ Name} →S_Name is a Trivial functional
dependency in this case because the dependant S_Name is a subset of the
determinant {Roll_No, S_Name}.
• { Roll_No } → { Roll_No }, { S_Name } → { S_Name } and { S_Age } → {
S_Age } are also Trivial.
Non-Trivial Functional Dependency
• It is the inverse of Trivial functional dependence. Formally, a
Dependent is a Non-Trivial functional dependency if it is not a subset
of the determinant.
• If D is not a subset of C, C→D is said to have a non-trivial functional
dependency. Non-trivial functional dependency is defined as a
functional dependency C→ D where C is a set of attributes and D is
also a set of attributes but not a subset of C.
• For example Roll_No→S_Name is a non-trivial functional dependency in this
case since S_Name(dependent) is not a subset of Roll_No (determinant).
• Similarly, {Roll_No, Name}→ Age are non-trivial functional dependencies.
Transitive Functional Dependency
• Transitive Dependency occurs when an indirect interaction results in
functional dependency. As a result, if C→ D and D ->Z are true, then
C ->Z is a transitive dependency.
• Transitive dependency causes deletion, update, and insertion errors in
the database and is regarded as poor database design.
Armstrong’s Axioms in Functional Dependency in DBMS
Armstrong Axioms
• The term Armstrong Axioms, introduced by William W. Armstrong,
• that is used to test the logical implication of functional dependencies.
• If F is a set of functional dependencies then the closure of F, denoted as F+, is the set of all
functional dependencies logically implied by F.
• Armstrong’s Axioms are a set of rules, that when applied repeatedly, generates a closure of
functional dependencies.
Axioms
i. Axiom of Reflexivity: If A is a set of attributes and B is a subset of A, then A holds B. If B⊆A
then A→B. This property is trivial property.
ii. Axiom of Augmentation: If A→B holds and Y is the attribute set, then AY→BY also holds. That
is adding attributes to dependencies, does not change the basic dependencies. If A→B,
then AC→BC for any C.
iii. Axiom of Transitivity: Same as the transitive rule in algebra, if A→B holds and B→C holds,
then A→C also holds. A→B is called A functionally which determines B. If X→Y and Y→Z,
then X→Z.
Armstrong’s Axioms in Functional Dependency in DBMS
Secondary Rules
These rules can be derived from the above axioms.
i. Union: If A→B holds and A→C holds, then A→BC holds. If X→Y and X→Z then X→YZ.
iii. Decomposition: If A→BC holds then A→B and A→C hold. If X→YZ then X→Y and X→Z.
iv. Pseudo Transitivity: If A→B holds and BC→D holds, then AC→D holds.
If X→Y and YZ→W then XZ→W.
v. Self Determination: It is similar to the Axiom of Reflexivity, i.e. A→A for any A.
vi. Extensivity: Extensivity is a case of augmentation. If AC→A, and A→B, then AC→B.
Similarly, AC→ABC and ABC→BC. This leads to AC→BC.
Armstrong’s Axioms in Functional Dependency in DBMS
Advantages of Using Armstrong’s Axioms in Functional Dependency
• They provide a systematic and efficient method for inferring additional functional dependencies from a given
set of functional dependencies, which can help to optimize database design.
• They can be used to identify redundant functional dependencies, which can help to eliminate unnecessary data
and improve database performance.
• They can be used to verify whether a set of functional dependencies is a minimal cover, which is a set of
dependencies that cannot be further reduced without losing information.
• The process of using Armstrong’s axioms to infer additional functional dependencies can be computationally
expensive, especially for large databases with many tables and relationships.
• The axioms do not take into account the semantic meaning of data, and may not always accurately reflect the
relationships between data elements.
• The axioms can result in a large number of inferred functional dependencies, which can be difficult to manage
and maintain over time.