0% found this document useful (0 votes)
20 views

Functional Dependancy ABES

Uploaded by

dhyanimishti12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Functional Dependancy ABES

Uploaded by

dhyanimishti12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 92

Quality Content for Outcome based Learning

Functional Dependency
(Module 4)

Ver. No.: 1.1 Copyright © 2021, ABES Engineering College


General Guideline
© (2021) ABES Engineering College.

This document contains valuable confidential and proprietary information of ABESEC. Such confidential and
proprietary information includes, amongst others, proprietary intellectual property which can be legally protected and
commercialized. Such information is furnished herein for training purposes only. Except with the express prior
written permission of ABESEC, this document and the information contained herein may not be published,
disclosed, or used for any other purpose.

2
Copyright © 2021, ABES Engineering College
Session Plan
 Introduction to Functional Dependency

 Types of Functional Dependency

 Armstrong's Axioms in Functional Dependency

 Attribute Closure

 Identifying Keys in a Relations using Attribute Closure

 Prime Attribute and Non-Prime Attribute

 Equivalence of Sets of Functional Dependencies

 Canonical Cover or Minimal Set of Functional Dependency


3
Copyright © 2021, ABES Engineering College
Quality Content for Outcome based Learning

Functional Dependency

Ver. No.: 1.1 Copyright © 2021, ABES Engineering College


Introduction – Functional Dependency

 A good relation (table) design is one, which has minimum redundancy and minimum
data dependency among the attributes of the relation (table).
 By minimizing the data dependency, we reduce the number of anomalies that may
occur when the database is used.
 Functional dependency is one of the core concept in the relational database design
theory
 In this unit we will study the concept of functional dependency, key identification using
functional dependencies, the equivalency of functional dependencies sets, and
canonical cover

5
Copyright © 2021, ABES Engineering College
Functional dependency in a relation (table)

 A functional dependency (FD) is a relationship that exists between two


attributes of a Relation (table).
 For any Relation R, attribute Y is said to be functionally dependent on
attribute X, if, for every valid instance of X, the value of X uniquely
determines the value of Y. This relationship is indicated by the representation
below:
X→Y
X can determine Y, means if t1.X = t2.X then t1.Y = t2.Y, where t1 and t2 are two tuples of the
Relation.
X & Y can be single attributes or a set of attributes
The left side of the above FD is called the determinant, and the right side is
the dependent

6
Copyright © 2021, ABES Engineering College
Process to identify Functional Dependencies in
a given relation
 What kind of dependencies can we observe among the attributes in Relation
R?
A→B, A→C, A→D, A→E (these are true as A is a key and unique for all
tuples)
B→C (this is not true, as t1.B = t2.B but t1.C ≠ t2.C)
B→D (this is not true, as t1.B = t2.B but t1.D ≠ t2.D)
B→E (this is true, as t1.B = t2.B and t1.E = t2.E & t3.B = t4.B and t3.E = t4.E)
C→D (this is true, as t1.C = t3.C and t1.D = t3.D & t2.C = t4.C and t2.D = t4.D)
C→E (this is true, as t1.C = t3.C and t1.E = t3.E & t2.C = t4.C and t2.E = t4.E)
D→C (this is not true, as t1.D = t3.D = t5.D but t1.C = t3.C ≠ t5.C)
BC→D, BC→E, BC→A (these are true as BC is a key and unique for all
tuples)
BD→E, BD→C, BD→A (these are true as BD is a key and unique for all
tuples)
 We can use the above process to identify various functional dependencies in
the given Relation.

7
Copyright © 2021, ABES Engineering College
Functional Dependency- Example
Example
Assume we have an employee relation with attributes: EMPLOYEE
E-ID, E-NAME, E-CITY, E-STATE. Relation/Table
E-ID attribute can uniquely identify (determine) the E- E-
E-ID E-NAME E-CITY
NAME attribute of employee table because if we know the STATE
E-ID, we can tell that employee name associated with it. E001 John Delhi Delhi
Functional dependency can be written as: E002 Mary Delhi Delhi
E-ID → E-NAME E003 John Noida U.P.
We can say that E-NAME is functionally dependent on E-ID.

Can we say
E-NAME -> E-CITY
E-CITY -> E-STATE

Copyright © 2021, ABES Engineering College


Functional dependency in a relation (table)…
Example

 roll_no of the student can uniquely identify the first_name, middle_name, dob, gender etc.. of a student. The
functional dependency can be written as:
Roll_no → first_name
Roll_no → dob
Roll_no → gender
 One more functional dependency exists in the above Relation: city → state
 Can we say: city → pincode, from the current relation instance, we can say that this functional dependency
exists, however from a database design perspective, this might be a wrong assumption as bigger cities can
have multiple pin codes within them.

9
Copyright © 2021, ABES Engineering College
Question on FD (GATE 2002)
Q. From the following instance of a relation schema R(A,B,C) we can conclude that:
From the relational instance given, we may strike out FD s that
do not hold. e.g. B does not functionally determine C(This is
true). But we cannot say that A functionally determines B for
the entire relation itself. This is because that, A->B holds for
this instance, but in future there might be some tuples added to
the instance that may violate A->B. So overall on the relation
we cannot conclude that A->B, from the relational instance which
is just a subset of an entire relation

A. A functionally determines B and B function­ally determines C


B. A functionally determines B and B does not functionally determine C
C. B does not functionally determine C
D. A does not functionally determine B and B does not functionally determine C

Copyright © 2021, ABES Engineering College


Question on FD(GATE-2000)

Given the following relation instance.


X Y Z
1 4 2
1 5 3
1 6 3
3 2 2

Which of the following functional dependencies are satisfied by the instance?

A. XY -> Z and Z -> Y

B. YZ -> X and Y -> Z

C. YZ -> X and X -> Z

D. XZ -> Y and Y -> X

13
Copyright © 2021, ABES Engineering College
Question on FD(GATE-2000)

Given the following relation instance.


X Y Z
1 4 2
1 5 3
1 6 3
3 2 2

Which of the following functional dependencies are satisfied by the instance?

A. XY -> Z and Z -> Y

B. YZ -> X and Y -> Z

C. YZ -> X and X -> Z

D. XZ -> Y and Y -> X

14
Copyright © 2021, ABES Engineering College
Question on FD(GATE 2005)
Q. In a schema with attributes A, B, C, D and E, following set of functional
dependencies are given:
F={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

15
Copyright © 2021, ABES Engineering College
Question on FD(GATE 2005)
Q. In a schema with attributes A, B, C, D and E, following set of functional
dependencies are given:
F={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

16
Copyright © 2021, ABES Engineering College
Quality Content for Outcome based Learning

Types of functional dependencies

Ver. No.: 1.1 Copyright © 2021, ABES Engineering College


Types of functional dependencies

Functional dependencies can be classified into four types:

1. Trivial Functional Dependency


2. Non-trivial Functional Dependency
3. Transitive Functional Dependency
4. Multivalued Functional Dependency
5. Inclusion Dependency

16
Copyright © 2021, ABES Engineering College
Trivial Functional Dependency
 In Trivial Functional Dependency, a dependent is always a subset of the determinant. i.e.,
If X→Y, and Y is the subset of X, it is called trivial functional dependency.
 Trivial Functional Dependency occurs in a Composite Primary Key.
 Each attribute has a trivial functional dependency on itself.

(dept_id, section_name) → (section_name) is a trivial functional dependency, since the


dependent section_name is a subset of determinant set (dept_id, section_name)
Similarly, dept_id → dept_id is also an example of trivial functional dependency

19
Copyright © 2021, ABES Engineering College
Non-trivial Functional Dependency
 In Non-trivial functional dependency, the dependent is strictly not a subset of the determinant. i.e., If
X→Y, and Y is not a subset of X, then it is called Non-trivial functional dependency.

dept_id → dept_name is a non-trivial functional dependency, since the dependent dept_name is not
a subset of determinant dept_id.
Similarly, (dept_id, dept_name) → dept_location is also a non-trivial functional dependency, since
dept_location is not a subset of (dept_id, dept_name).

20
Copyright © 2021, ABES Engineering College
Transitive Functional Dependency
 In transitive functional dependency, the dependent is indirectly dependent on the determinant. i.e., If
X→Y, there exists a set of attributes Z in the Relation that is not a Candidate Key and both X→Z and
Z→Y hold, thus Y is transitively dependent on X.
 A transitive dependency can only occur in a Relation of three or more attributes.

The functional dependencies are:


roll_no → name, roll_no → gender, roll_no → city, roll_no → state, city → state
Here, roll_no → state is a transitive functional dependency because an attribute city exists, which is
not a Candidate Key, and roll_no → city & city → state hold.

21
Copyright © 2021, ABES Engineering College
Transitive Functional Dependency…
 Let’s assume a student relation as below.

The functional dependencies are:


roll_no → name, roll_no → adhaar_no, roll_no → gender, roll_no → city, roll_no → state, adhaar_no
→ roll_no, adhaar_no → name, adhaar_no → gender, adhaar_no → city, adhaar_no → state, city →
state
Is there a transitive dependency here between roll_no → name, as roll_no → adhaar_no &
adhaar_no → name holds true?
The answer is NO because the second determinant adhaar_no is the Candidate Key here.

Copyright © 2021, ABES Engineering College


Question on FD(GATE 2015)
Consider the relation X(P, Q, R, S, T, U) with the following set of functional
dependencies:-
F = { {P, R} → {S,T}, {P, S, U} → {Q, R} }

Which of the following is the trivial functional dependency in F+ is closure of F?


A. {P,R}→{S,T}
B. {P,R}→{R,T}
C. {P,S}→{S} A functional
D. {P,S,U}→{Q} dependency X -> Y is
trivial if Y is a
subset of X.

Copyright © 2021, ABES Engineering College


Question on FD(GATE MOCK 2018)
Which of the following FD can’t be implied from FD set: {A->B, A->BC, C->D} ?

A. A->C
B. B->D
C. BC->D A->C can be implied by A->BC and
D. All of the above BC->D can be implied by C->D. But
we can not get B->D sing given
functional dependencies.
Option (B) is correct.

Copyright © 2021, ABES Engineering College


Multivalued functional dependency
 To understand a multivalued dependency, it is helpful to revisit what a functional dependency is.
 Functional dependencies rule out certain tuples from being in a Relation i.e. If A→B, we cannot
have two tuples with the same A value but different B values.
Suppose an attribute X uniquely determines an attribute Y. In that case, Y is functionally
dependent on X. This is written as X→Y. For example, in the STUDENT Relation below, the
roll_no determines the name:

This functional dependency can be written: roll_no → name.


Each roll_no determines exactly one name and no more.
 In contrast to the functional dependency, the multivalued dependency requires that certain
tuples be present in a relation. Therefore, a multivalued dependency is a special case of tuple-
generating dependency.
 Multivalued dependencies are a consequence of handling multivalued attributes as part of the
normalization process (discussed in detail in later units)

Copyright © 2021, ABES Engineering College


Multivalued Dependency Cont.…

Suppose we have following schema:


employee (emp_id, emp_name )
emp_info (emp_id, dependent, phone_num )

Here, emp_id → {dependent, phone_num} is a multivalued functional dependency,


since the dependents ’dependent’ & ’phone_num’ are not dependent on each
other(i.e. dependent → phone_num or phone_num → dependent doesn’t exist !). So,
here we have a MVD emp_id->>dependent and emp_id->>phone_num.

Copyright © 2021, ABES Engineering College


Formal Definition of MVD

A multivalued dependency (MVD) X —>> Y specified on relation schema R, where X and Y are
both subsets of R, specifies the following constraint on any relation state r of R: If two tuples t1 and t2
exist in r such that t1[X] = t2[X], then two tuples t3 and t4 should also exist in r with the following
properties, where we use Z to denote (R - (X υ Y)):
 t3[X] = t4[X] = t1[X] = t2[X].
 t3[Y] = t1[Y] and t4[Y] = t2[Y].
 t3[Z] = t2[Z] and t4[Z] = t1[Z].

The EMP relation with two MVDs: ENAME —>>


PNAME and ENAME —>> DNAME.

Copyright © 2021, ABES Engineering College


Types of MVD

Multivalued dependency categorized into two types such as:


 Trivial Multivalued dependency
 Non-trivial Multivalued dependency

Copyright © 2021, ABES Engineering College


Trivial Multivalued dependency Cont.…
 Trivial Multivalued Dependency –An MVD A →→ B on R is trivial if B⊆A or A ∪ B = R (i.e. A ∪ B is all
attributes of R).
 It occurs when we have one multivalued attribute in a relation
Let’s take an example of a student relation, where we have one multivalued attribute sport which
contains the name of sports played by a student. (a student can play multiple sports)

roll_no name sport


191306280 Aayushi Tennis, Basketball

As per the formal definition of a relation, an attributes can hold only atomic values, hence the
above relation is in-valid and needs be converted as below
roll_no name sport
191306280 Aayushi Tennis
191306280 Aayushi Basketball

In above relation Trivial Multivalued dependency occurs because there is one multivalued
attribute i.e, sports.

Copyright © 2021, ABES Engineering College


Non-trivial Multivalued dependency
 Non-trivial Multivalued Dependency - occurs when there are more than one independent multivalued
attribute in a Relation.
If a student relation has two (or more) multivalued attributes, sports ( a student can play multiple
sports) and clubs ( a student can be a part of multiple clubs), and these two attributes are
independent of each other, this creates a non-trivial multivalued dependency in a relation.
roll_no name sport club
191306280 Aayushi Tennis, Basketball Dramatics, NSS
Converting the above into a valid relation to hold only atomic values.

roll_no name sport club


191306280 Aayushi Tennis Dramatics
191306280 Aayushi Basketball NSS
191306280 Aayushi Tennis NSS
191306280 Aayushi Basketball Dramatics
As we have two multivalued independent attributes in the same relation, we get into a problem of
having to repeat every value of one attribute with every value of another attribute to keep the relation
state consistent and to maintain the independence among the attributes involved.
In this case: roll_no →→ sport and roll_no →→ club
This is read as "roll_no multi-determines sport" and "roll_no multi-determines club".

Copyright © 2021, ABES Engineering College


Inclusion Dependency
• Multivalued dependency and join dependency can be used to guide database design although
they both are less common than functional dependencies.
• Inclusion dependencies are quite common. They typically show little influence on designing of the
database.
• The inclusion dependency is a statement in which some columns of a relation are contained in
other columns.
• The example of inclusion dependency is a foreign key. In one relation, the referring relation is
contained in the primary key column(s) of the referenced relation.
• Suppose we have two relations R and S which was obtained by translating two entity sets such
that every R entity is also an S entity.
• Inclusion dependency would be happen if projecting R on its key attributes yields a relation that is
contained in the relation obtained by projecting S on its key attributes.
• In inclusion dependency, we should not split groups of attributes that participate in an inclusion
dependency.
• In practice, most inclusion dependencies are key-based that is involved only keys.

29
Copyright © 2021, ABES Engineering College
Armstrong’s Axioms in Functional Dependency in DBMS

Armstrong's Axioms has two different set of rules,


1. Axioms or primary rules
1. Axiom of Reflexivity
2. Axiom of Augmentation
3. Axiom of Transitivity
2. Additional rules or Secondary rules
1. Union
2. Composition
3. Decomposition
4. Pseudo Transitivity

Copyright © 2021, ABES Engineering College


1. Axiom of Reflexivity:

If A is a set of attributes and B is a subset of A, then A holds B. { A → B }

Example:
X = {a, b, c, d, e}
Y = {a, b, c}

Copyright © 2021, ABES Engineering College


2. Axiom of Augmentation:

If A hold B and C is a set of attributes, then AC holds BC. {AC → BC}


i.e, if X→Y then XA→YA,
where A is set of attributes

Example:
For R(ABCD), if A → B then AC → BC

Copyright © 2021, ABES Engineering College


3. Axiom of Transitivity:

If A holds B and B holds C, then A holds C.


i.e, If {A → B} and {B → C}, then {A → C}

If A holds B {A → B} means that A functionally determines B.

Example:
if (X→Y & Y→Z) then X→Z

Copyright © 2021, ABES Engineering College


Secondary Rules - Union

If X determines Y and X determines Z, then X must also determine Y and Z.


i.e, If X → Y and X → Z then X → YZ

Proof:

1. X → Y (given)
2. X → Z (given)
3. X → XY (using Augmentation Rule on 1 by augmentation with X. Where XX = X)
4. XY → YZ (using Augmentation Rule on 2 by augmentation with Y)
5. X → YZ (using Transitive Rule on 3 and 4)

Copyright © 2021, ABES Engineering College


2. Decomposition
If X determines Y and Z, then X determines Y and X determines Z separately.
i.e, If X → YZ then X → Y and X → Z

Proof:

1. X → YZ (given)
2. YZ → Y (using Reflexivity Rule)
3. X → Y (using Transitive Rule on 1 and 2)

Copyright © 2021, ABES Engineering College


3. Composition

If P holds Q (P → Q) and A holds B (A → B), then PA → QB.

Proof,
1. P → Q (Given)
2. A → B (Given)
3. PA → QA (Augmentation of 1 and A)
4. PA → Q (Decomposition of 3)
5. PA → PB (Augmentation of 2 and P)
6. PA → B (Decomposition of 5)
7. PA → QB (Union 4 and 6)

Copyright © 2021, ABES Engineering College


4. Pseudo Transitivity

In Pseudo transitive Rule, if X determines Y and YZ determines W, then XZ


determines W.

i.e, If X → Y and YZ → W then XZ → W

Proof:

1. X → Y (given)
2. WY → Z (given)
3. WX → WY (using Augmentation Rule on 1 by augmenting with W)
4. WX → Z (using Transitive Rule on 3 and 2)

Copyright © 2021, ABES Engineering College


Types of Functional Dependency
 Full Functional Dependency: In a functional dependency A→B (A is a set of attributes and B is
another set of attributes), the dependency where B is fully dependent on A and not on any of the
subsets of A is called Full Functional dependency.
For example, assume that attributes P and Q together can only uniquely identify the value of the other
attribute R. Then, PQ→R is Full Functional Dependency.

 Partial Functional Dependency: A functional dependency A→B (A is a set of attributes and B is


another set of attributes) is said to be partial if any subset of A can still recognize B uniquely.
For example, in a functional dependency PQ→R, if either P alone or Q alone can uniquely identify R,
this is said to be Partial Functional Dependency. We read this as R is partially functionally dependent
on P or R is partially functionally dependent on Q.

Example:- let us consider the set F of functional dependencies for Relation R (A,B,C,D); F =
{A→B, AD→B}. In this case, the FD A→B is full functional dependency whereas AD→B is partial
functional dependency; i.e., B is not fully functionally dependent on AD; instead, it depends on A
alone.

Copyright © 2021, ABES Engineering College


Question on FD(ISRO 2018)
The set of attributes X will be fully functionally dependent on the set of attributes
Y if the following conditions are satisfied.
A. X is functionally dependent on Y
B. X is not functionally dependent on any subset of Y
C. Both (a) and (b)
D. None of these
The term full functional dependency is used to indicate
the minimum set of attributes in a functional dependency.
In other words, the set of attributes X will be fully
functionally dependent on the set of attributes Y if the
following conditions are satisfied:
i) X is functionally dependent on Y and
ii) X is not functionally dependent on any subset of Y.

Copyright © 2021, ABES Engineering College


Attribute Closure
 Attribute closure of an attribute set can be defined as a set of attributes that can be
functionally determined from it.

 The set of attributes that are functionally dependent on attribute A is called the
attribute closure of A and it can be represented as A+.

 Steps to find the attribute closure of A (represented as A+)


Add A to A+
Recursively add attributes that can be functionally determined from attributes of the Relation R.

Copyright © 2021, ABES Engineering College


Algorithm for Finding the Attribute Closure
Steps to find the attribute closure of A (represented as A+)
• Add A to A+
• Recursively add attributes that can be functionally determined from attributes of the
Relation R.
Algorithm to compute a+, the closure of a under F
Result:= a; Here , a is attribute for which we are
while (changes to Result) do finding the closure
for each B → Y in F do F is the set of FDs
Begin
B->Y one FD in the F
if B ⊆ Result then Result := Result ∪ Y
End

41
Copyright © 2021, ABES Engineering College
Attribute Closure…
Example - Find the attribute closures of Relation R(A,B,C,D,E) with functional dependency (FD) set F =
{AB→C, B→D, C→E, D→A}
To find B+, we will add an attribute in the set using various FD, which has been shown in steps below:

B+ = {B,D,A,C}
We can find (C, D)+ by adding C and D into the set (triviality) and then E using(C→E) and then A using (D→A)
(C,D)+ = {C,D,E,A}
Similarly, we can find (B, C)+ by adding B and C into the set (triviality) and then D using (B→D) and then E using
(C→E) and then A using (D→A)
(BC)+ = {B,C,D,E,A}

Copyright © 2021, ABES Engineering College


Question on Attribute closure….(UGC NET 2014)

Q. Let R = ABCDE is a relational scheme with functional dependency set F = {A


→ B, B → C, AC → D}. The attribute closures of A and E are

A. ABCD, φ
B. ABCD, E
C. Φ, φ
D. ABC, E

43
Copyright © 2021, ABES Engineering College
Closure of a Set of Functional Dependencies

Algorithm to find the FD closure

Procedure to compute F+
F+=F
repeat
for each functional dependency f in F+
apply reflexive and augmentation rules on f
add the resulting dependencies to F+
for each pair of functional dependencies f1 and f2 in F+
if f1 and f2 can be combined using transitivity
add the resulting function dependencies to F+
Until F+ does not change any further
44
Copyright © 2021, ABES Engineering College
Example for finding FD closure

 Given a Relation schema R=(A,B,C,G,H,I) and set of Functional


dependencies
F={A->B, A->C, CG->H, CG->I, B->H}
from F, it is possible to derive following dependencies.
A->H (By using transitivity A->B, B->H)
CG->HI ( By using union CG->H, CG->I)
AG->I (By using Pseudo transitivity rule implies that AG->I)
AG->CG ( By using Augmentation rule X->Y, XZ->YZ)
Etc.

45
Copyright © 2021, ABES Engineering College
Identifying Keys in a Relation by using
Attribute Closure
Definition of Super Key and Candidate Key (revisiting)
 Super Key - It is a set of attributes of a relation that can be used to identify a tuple uniquely.
 Candidate Key - It is a minimal set of attributes of a relation that can be used to identify a tuple uniquely.

Identifying Super Key and Candidate Key using attribute closure


 The set of attributes whose attribute closure is a set of all attributes of Relation is called the Super Key of the
Relation.
 The minimal set of attributes whose attribute closure is a set of all attributes of Relation is called the Candidate
Key of the Relation. This means that a Super Key whose proper subset is not a Super Key is a Candidate
Key.
What are Subsets and Proper Subset?
If A and B are two sets, and every element of set A is also an element of set B, then A is called a subset of
B. Subset is denoted by ‘⊆’, so A ⊆ B. The definition of "subset" allows the possibility that the first set is
the same as (equal to) the second set.
However,
A proper subset of a set A is a subset of A that is not equal to A. In other words, if B is a proper subset
of A, then all elements of B are in A, but A contains at least one element that is not in B.
For example, if A={1,3,5} then B={1,5} is a proper subset of A. The set C={1,3,5} is a subset of A, but it is
not a proper subset of A since C=A. The proper subset is denoted by the symbol ‘ ⊂'. So as per the above
example, B ⊂ A and C ⊆ A.

Copyright © 2021, ABES Engineering College


Finding Super Keys of a relation using FD sets and
attribute closure
Definition - Any subset of attributes of a Relation that can uniquely identify all the tuples of that
Relation is known as a Super Key.
By the formal definition of a Relation, we know that all the tuples of a Relation should be unique. So the set
of all attributes itself is a Super Key.

Let us find the Super Keys of Relation R(A,B,C,D,E) with FD set F = {AB→C, B→E, C→D}

Now let us find attribute closure of all attributes individually and in combination to find the other possible
Super Keys.

How many attribute combinations are possible?


Assume a Relation R (a1, a2, a3), the possible Super Keys are:- {a1,a2,a3}, {a1,a2}, {a2,a3}, {a1,a3}, {a1}, {a2}, {a3} =
7 nos.
The total number of possible Super Keys is given by the formula 2n-1, Where n = Total number of attributes.

In the above Relation R(A, B, C, D, E), we will have 25-1 = 31 possible combinations, which can be Super Keys.

Copyright © 2021, ABES Engineering College


Finding Super Keys of a relation using FD sets and
attribute closure…
Now after computing the closures of all the possible combination of attributes of
Relation R(A,B,C,D,E) with FD set F = {AB→C, B→E, C→D}, the following Super
Keys have been found:
1. {A,B,C,D,E}
2. {A,B,D,E}
3. {A,B,C,E}
4. {A,B,C,D}
5. {A,B,E}
6. {A,B,D}
7. {A,B,C}
8. {A,B}

Copyright © 2021, ABES Engineering College


Finding Candidate Keys of a relation using FD sets
and attribute closure…
As per the definition of Candidate Key - The minimal set of attributes whose attribute closure is a set of all attributes of
Relation is called the Candidate Key of the Relation. This means that a Super Key whose proper subset is not a
Super Key is a Candidate Key.
Now, if we look at the list of Super Keys, which we have found for Relation R(A,B,C,D,E), none of the Super Keys have
a proper subset which is not a Super Key except {A,B}.

For example –
 Super Key {A,B,C,D,E} – attribute {A,B} is a proper subset of this Super Key and it is itself a Super Key,
so {A,B,C,D,E} can’t be a Candidate Key
 Super Key {A,B,C,E} - attribute {A,B} is a proper subset of this Super Key and it is itself a Super Key, so
{A,B,C,E} can’t be a Candidate Key
 Super Key {A,B,D} - attribute {A,B} is a proper subset of this Super Key and it is itself a Super Key, so
{A,B,D} can’t be a Candidate Key
 Super Key {A,B} - attribute {A} & {B} are proper subset of this Super Key, but neither {A} nor {B} is itself
a Super Key, so {A,B} is a Candidate Key
So (A,B) is Candidate Key for Relation R(A,B,C,D,E) with FD set F = {AB→C, B→E, C→D}

Copyright © 2021, ABES Engineering College


Prime attributes and non-prime attributes

The attributes of a Relation that are part of Candidate Keys are called Prime
Attributes, and the remaining attributes are called Non-Prime Attributes.
In Relation R(A,B,C,D,E) with FD set F = {AB→C, B→E, C→D},
(A,B) is Candidate Key, therefore,
 (A),(B) – Prime Attributes
 (D),(C),(E) – Non-Prime Attributes

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure
Identifying Candidate Keys is very important for designing and implementing any database, as Candidate Keys help us
to define Primary Key and other keys which are essential for any database.
The process of identifying Candidate Keys illustrated above is very lengthy and time-consuming. We will now learn a
more practical and shorter way of identifying the Candidate Keys.

Steps for finding Candidate Keys


1. Determine all essential attributes of the given Relation.
 Essential attributes are those attributes that are not present on the right-hand side (RHS) of any functional
dependency.
 Essential attributes are always a part of every Candidate Key because they can not be determined by other
attributes.
2. Take a closure of essential attributes.
 If the closure of essential attributes returns all attributes of the Relation, essential attributes become the
Candidate Key and the only possible Candidate Key.
 If the closure of essential attributes does not return all attributes of the Relation
a) Take the whole Relation and start discarding the dependent attributes such that the remaining attributes
give a closure containing all attributes of the Relation.

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure…
Steps for finding Candidate Keys (contd..)
b) The attributes remaining after discarding will be a Super Key as their closure is returning all
attributes of the Relation.
c) Now check if the proper subsets of this Super Key are Super Keys or not.
d) If the proper subsets are not the Super Key, then this Super Key becomes the Candidate Key.
» Check for more Candidate Keys by replacing already identified prime attributes (in the
Candidate Key) by their determinants if these prime attributes happen to be on the RHS for
any FD.
» Repeat this process till all options are considered.
e) If the proper subset is a Super Key, we need to check if the proper subset of this proper subset
is the Super Key. We need to keep checking till we reach a proper subset which is not a Super
Key. This proper subset will be the Candidate Key.
» Check for more Candidate Keys by replacing already identified prime attributes (in the
Candidate Key) by their determinants if these prime attributes happen to be on the RHS for
any FD.
» Repeat this process till all options are considered.

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure…
Example 1
Let R(A,B,C,D,E,F) be a Relation schema with the following FDs: A→B, C→D, D→E
Here, the attributes which are not present on RHS of any functional dependency are A, C, and F.
So, essential attributes are- A, C, and F.
Let’s take the attribute closure of essential attributes:-
(ACF)+
= {A,C,F}
= {A,C,F,B} ( Using A→B )
= {A,C,F,B,D} ( Using C→D )
= {A,C,F,B,D,E} ( Using D→E )
We can see that the closure of essential attributes returns all attributes of the Relation.
So we can conclude that (ACF) is a Candidate Key. Also, in this case, since the essential attributes are sufficient to
determine all attributes of the Relation, this Relation will have only one Candidate Key, which is the combination of the
essential attributes.

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure…
Example 2
Let R(A,B,C,D,E,F) be a Relation schema with the following FDs: C→F, E→A, EC→D, A→B
Essential attributes – C and E
Let’s take attribute closure of essential attributes:-
(CE)+
= {C,E}
= {C,E,F} ( Using C→F )
= {A,C,E,F} ( Using E→A )
= {A,C,D,E,F} ( Using E,C→D )
= {A,B,C,D,E,F} ( Using A→B )
We can see that the closure of essential attributes returns all attributes of the Relation.
So we can conclude that (CE) is a Candidate Key and an only Candidate Key.

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure…
Example 3
Let R(A,B,C,D,E) be a Relation schema with the following FDs: BC→ADE, D→B
The FDs can be re-written as below using Armstrong’s Axiom of decomposition:
BC→A, BC→D, BC→E, D→B
Essential attributes – C
Let us take attribute closure of essential attributes:-
(C)+ = {C}
We can see that the closure of essential attributes does not return all attributes of the Relation.
So, we can conclude that though (C) is an essential element of any Candidate Key; however, it is not a
Candidate Key.

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure…
Example 3 (contd.)
Let us take the Relation R(A,B,C,D,E) and start discarding the dependent attributes.
(ABCDE)+ = {A,B,C,D,E}
(BC)+ = {A,B,C,D,E} – discarding A, D & E as they can be determined by B & C
So, (BC) is a Super Key – To check if it is a Candidate Key, its proper subsets should not be Super Keys.
(B) & (C) are proper subsets of (BC)
(B)+ = {B} -----so not a Super Key
(C)+ = {C} -----so not a Super Key
Therefore (BC) is a Candidate Key – B, C are prime attributes.
To check if there are any more Candidate Keys – Check if already identified prime attributes are on RHS
and can be replaced by its determinant.
From the FD set, we can replace B with D.
Check if (DC) is a Candidate Key as per the above process. We will find that (DC) is also a Candidate Key.

Therefore the given Relation has two Candidate Keys – (BC) & (DC)

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure…
Example 4
Let R(A,B,C,D,E) be a Relation schema with the following FDs: AB→CD, D→A, BC→DE
The FDs can be re-written as below using Armstrong’s Axiom of decomposition:
AB→C, AB→D, D→A, BC→D, BC→E
Essential attributes – B
Let us take attribute closure of essential attributes:-
(B)+= {B}
So, we can see that the closure of essential attributes does not return all attributes of the Relation.
So, we can conclude that though {B} is an essential element of any Candidate Key, however, it is not a
Candidate Key.

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure…
Example 4 (contd.)
Let us take the Relation R(A,B,C,D,E) and start discarding the dependent attributes.
(ABCDE)+ = {A,B,C,D,E}
(ABE)+ = {A,B,C,D,E} – discarding C & D as they can be determined by A & B
So, (ABE) is a Super Key – To check if it is a Candidate Key, its proper subsets should not be Super Keys.
(AB) & (BE) are proper subsets of (ABE), not considering subset AE as B is an essential attribute
(AB)+ = {A,B,C,D,E} ----- is a Super Key, so (ABE) cannot be a Candidate Key
(BE)+ = {B,E} -----so not a Super Key
(AB) can be a Candidate Key if its proper subsets (A) & (B) are not Super Keys
(A)+ = {A} -----so not a Super Key
(B)+ = {B} -----so not a Super Key
Therefore, (AB) is a Candidate Key.

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure…
Example 4 (contd.)
To check if there are any more Candidate Keys – Check if already identified prime attributes (A) & (B) are
on RHS and can be replaced by its determinant.
We can see that A can be replaced by D, so we need to check if (DB) is a Candidate Key as per the above
process. We will find that (DB) is also a Candidate Key.
To check if there are any more Candidate Keys – Check if already identified prime attributes (A), (B) & (D)
are on RHS and can be replaced by its determinant.
We can see that D can be replaced by BC, so we need to check if (CB) is a Candidate Key as per the
above process. We will find that (CB) is also a Candidate Key.
Therefore the given Relation has three Candidate Keys – (AB), (BC), (BD)

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure…
Example 5
Let R (W,X,Y,Z) be a Relation schema with the following FDs: Z→W, Y→XZ, WX→Y
The FDs can be re-written as below using Armstrong’s Axiom of decomposition:
Z→W, Y→X, Y→Z, WX→Y
Essential attributes – NIL
Let us take the Relation R(W,X,Y,Z) and start discarding the dependent attributes.
(WXYZ)+ = {W,X,Y,Z}
(YZ)+ = {W,X,Y,Z} – discarding W & X as they can be determined by Y & Z respectively
So, (YZ) is a Super Key – To check if it is a Candidate Key, its proper subsets should not be Super Keys.
(Y) & (Z) are proper subsets of (YZ)
(Y)+ = {Y,X,Z,W} ----- is a Super Key, so (YZ) cannot be a Candidate Key
(Z)+ = {Z,W} -----so not a Super Key
(Y) is a Candidate Key as it is a minimal set with no proper subsets.

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure…
Example 5 (contd.)
To check if there are any more Candidate Keys – Check if the already identified prime attribute (Y) is on
RHS and can be replaced by its determinant.
We can see that Y can be replaced by WX (WX→Y), so we need to check if (WX) is a Candidate Key as
per the above process. We will find that (WX) is also a Candidate Key.
To check if there are any more Candidate Keys – Check if already identified prime attributes (Y), (W) & (X)
are on RHS and can be replaced by its determinant. We can see that W can be replaced by Z (Z→W), so
we need to check if (ZX) is a Candidate Key as per the above process. We will find that (ZX) is also a
Candidate Key.
To check if there are any more Candidate Keys – Check if already identified prime attributes (Y), (W), (X)
& (Z) are on RHS and can be replaced by its determinant.
We can see that X can be replaced by Y (Y→X), Z can be replaced by Y (Y→Z), so we need to check if
(ZY), (WY), (YX) are Candidate Keys as per the above process. As (ZY), (WY) & (YX) have (Y) as a
proper subset, and we found that (Y) is a Candidate Key (or a Super Key), so (ZY), (WY) & (YX) will not be
Candidate Keys.
Therefore the given Relation has three Candidate Keys – (Y), (WX), (ZX)

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure…
Example 6
Let R(A,B,C) be a Relation schema with the following FDs: A→B, B→A
Essential attributes – C
Let us take attribute closure of essential attributes:-
(C)+= {C}
So, we can see that the closure of essential attributes does not return all attributes of the Relation.
So, we can conclude that though {C} is an essential element of any Candidate Key; however, it is not a
Candidate Key.
Let us take the Relation R (ABC) and start discarding the dependent attributes.
(ABC)+ = {A,B,C}
(AC)+ = {A,C,B} – discarding B as it can be determined A
So, (AC) is a Super Key – To check if it is a Candidate Key, its proper subsets should not be Super Keys.

Copyright © 2021, ABES Engineering College


Short Cut for finding candidate keys using FD sets
and attribute closure…
Example 6 (contd.)
(A) & (C) are proper subsets of (AC)
(A)+ = {A,B} ----- so not a Super Key
(C)+ = {C} -----so not a Super Key
Therefore (AC) is a Candidate Key – B, C are prime attributes.
To check if there are any more Candidate Keys – Check if already identified prime attributes are on RHS
and can be replaced by its determinant.

From the FD set, we can replace A with B.


Check if (BC) is a Candidate Key as per the above process. We will find that (BC) is also a Candidate Key.

Therefore the given Relation has two Candidate Keys – (AC) & (BC)

Copyright © 2021, ABES Engineering College


Equivalence of Sets of Functional Dependencies
If we have two sets of FDs, FD1 & FD2, for a given Relation R, we will discuss how to find the relationship between
two FD sets.
1. If all FDs of FD1 can be derived from FDs present in FD2, we can say that FD2 ⊃ FD1.
2. If all FDs of FD2 can be derived from FDs present in FD1, we can say that FD1 ⊃ FD2.
3. If 1 and 2 both are true, FD1 ≡ FD2.

Copyright © 2021, ABES Engineering College


Equivalence of Sets of Functional Dependencies…

How to determine whether FD1 covers FD2 –

1. Calculate the closure of LHS (left-hand side) in FD2, for each FD in FD2,
with respect to FDs in FD1. If the closure includes the attributes on the RHS
(right-hand side), this FD will hold in FD1.
2. If this is the case for every FD in FD2, then FD1 covers FD2.
3. We determine whether FD2 and FD1 are equivalent by checking that FD2
covers FD1 and FD1 covers FD2 by using the above process.

Copyright © 2021, ABES Engineering College


Equivalence of Sets of Functional Dependencies…
Example
A Relation R(A,B,C,D,E) has the following two sets of FDs, find if they are equivalent:
FD1 = {A→C, AC→D, E→AD, E→H}
FD2 = {A→CD, E→AH}

Step 1 – Check if FD1 covers FD2.

Find closure of LHS all FDs in FD2, with respect to FDs in FD1, and see if the closure returns the
attributes on RHS.

(A)+ = {A,C,D} – the closure includes (C) & (D), thus A→CD holds in FD1 also.
(E)+ = {E,A,D,H} – the closure includes (A) & (H), thus E→AH holds in FD1 also.
As we can see that all FDs of FD2 hold in FD1 also; thus, FD1 covers FD2 (FD1 ⊃ FD2)

Copyright © 2021, ABES Engineering College


Equivalence of Sets of Functional Dependencies…
Example (contd.)
Step 2 – Check if FD2 covers FD1.
Find closure of LHS all FDs in FD1, with respect to FDs in FD2, and see if the closure returns the
attributes on RHS.
(A)+ = {A,C,D} – the closure includes (C), thus A→C holds in FD2 also.
(AC)+ = {A,C,D} – the closure includes (D), thus AC→holds in FD2 also.
(E)+ = {E,A,H,C,D} – the closure includes (A) & (D), thus E→AD holds in FD2 also.
(E)+ = {E,A,H,C,D} – the closure includes (H), thus E→H holds in FD2 also.
As we can see that all FDs of FD1 hold in FD2 also; thus, FD2 covers FD1 (FD2 ⊃ FD1)

As, FD1 covers FD2 (FD1 ⊃ FD2) & FD2 covers FD1 (FD2 ⊃ FD1), therefore FD1 is equivalent to
FD2 (FD1 = FD2).

Copyright © 2021, ABES Engineering College


MCQ’S
Q1.Given a relational schema R(A,B,C,D) set of functional dependencies P and Q
such that:
P = { A->B, B->C, AB->D } and Q = { A->B, B->C, A->C, A->D } using FD sets P and Q
which of the following options are correct?

A. P is a subset of Q
B. Q is a subset of P
C. P=Q
D. P≠Q

Copyright © 2021, ABES Engineering College


MCQ’S

Q 2.Given a relational schema R( X, Y, Z, W, V ) set of functional


dependencies P and Q such that:
P = { X → Y, XY → Z, W → XZ, W → V} and Q = { X → YZ, W → XV } using FD
sets P and Q which of the following options are correct?

A. P is a subset of Q
B. Q is a subset of P
C. P=Q
D. P≠Q

69
Copyright © 2021, ABES Engineering College
MCQ’S

Q 3. Given a relational schema R( A, B, C, D ) set of functional


dependencies P and Q such that:

P = { A → B, B → C, C → D } and Q = { A → BC, C → D } using FD sets P and


Q which of the following options are correct?

A. P is a subset of Q
B. Q is a subset of P
C. P=Q
D. P≠Q

70
Copyright © 2021, ABES Engineering College
MCQ’S

Q 4 Given a relational schema R( X, Y, Z ) set of functional dependencies P


and Q such that:

P = { X → Y, Y → Z, Z → X } and Q = { X → YZ, Y → X, Z → X } using FD sets


P and Q which of the following options are correct?

A. P is a subset of Q
B. Q is a subset of P
C. P=Q
D. P≠Q

71
Copyright © 2021, ABES Engineering College
Canonical Cover or Minimal Set of Functional
Dependency
We can define a set of functional dependencies FD to be minimal (canonical cover) if it
satisfies the following conditions:
1. Every dependency in FD has a single attribute for its right-hand side.
2. We cannot remove any dependency from FD and still have a set of dependencies
equivalent to FD.
3. On the left-hand side (LHS) of any functional dependency (FDs remaining after
condition two is met), we should not have any extraneous attribute (applicable when
LHS has more than one attribute). An attribute of a functional dependency is
extraneous if we can remove it without changing the closure of the set of functional
dependencies.

Copyright © 2021, ABES Engineering College


Canonical Cover or Minimal Set of Functional
Dependency…
Example 1:
Find the canonical cover of a relational schema R(A,B,C,D) with a set of FDs = {B→A, AD→BC, C→ABD}

Condition 1
Given FD = {B→A, AD→BC, C→ABD} to be decomposed using Armstrong Axiom’s decomposition rule.
B→A
AD→B ( using decomposition inference rule on AD→BC)
AD→C ( using decomposition inference rule on AD→BC)
C→A ( using decomposition inference rule on C→ABD)
C→B ( using decomposition inference rule on C→ABD)
C→D ( using decomposition inference rule on C→ABD)
Now set of FD = {B→A, AD→B, AD→C, C→A, C→B, C→D}

Copyright © 2021, ABES Engineering College


Canonical Cover or Minimal Set of Functional
Dependency…
Example 1 (contd.)
Condition 2
Calculating closure of all FD {B→A, AD→B, AD→C, C→A, C→B, C→D}
1. (B)+
a) Closure (B)+ = {B,A} using FD = {B→A, AD→B, AD→C, C→A, C→B, C→D}
b) Closure (B)+ = {B} using FD = {AD→B, AD→C, C→A, C→B, C→D}
From 1 a and 1 b, we found that both the Closure( by including B→A and excluding B→A ) are not
equivalent; hence FD B→A is important and cannot be removed from the set of FD.
Hence resultant FD = {B→A, AD→C, C→A, C→B, C→D}
2. (AD)+
a) Closure (AD)+ = {A,D,B,C} using FD = {B→A, AD→B, AD→C, C→A, C→B, C→D}
b) Closure (AD)+ = {A,D,C,B} using FD = {B→A, AD→C, C→A, C→B, C→D}
From 2 a and 2 b, we found that both the Closure (by including AD→B and excluding AD→B) are
equivalent; hence FD AD→B is not important and can be removed from the set of FD.
Hence resultant FD = {B→A, AD→C, C→A, C→B, C→D}

Copyright © 2021, ABES Engineering College


Canonical Cover or Minimal Set of Functional
Dependency…
Example 1 (contd.)
3. (AD)+
a) Closure (AD)+ = {A,D,C,B} using FD = {B→A, AD→C, C→A, C→B, C→D}
b) Closure (AD)+ = {A,D} using FD = {B→A, C→A, C→B, C→D}
From 3 a and 3 b, we found that both the Closure (by including AD→C and excluding AD→C ) are not
equivalent; hence FD AD→C is important and cannot be removed from the set of FD.
Hence resultant FD = {B→A, AD→C, C→A, C→B, C→D}
4. (C)+
a) Closure (C)+ = {C,A,B,D} using FD = {B→A, AD→C, C→A, C→B, C→D}
b) Closure (C)+ = {C,B,D,A} using FD = {B→A, AD→C, C→B, C→D}
From 4 a and 4 b, we found that both the Closure (by including C→A and excluding C→A) are
equivalent; hence FD C→A is not important and can be removed from the set of FD.
Hence resultant FD = {B→A, AD→C, C→B, C→D}

Copyright © 2021, ABES Engineering College


Canonical Cover or Minimal Set of Functional
Dependency…
Example 1 (contd.)
5. (C)+
a) Closure (C)+ = {C,B,D,A} using FD = {B→A, AD→C, C→B, C→D}
b) Closure (C)+ = {C,D} using FD = {B→A, AD→C, C→D}
From 5 a and 5 b, we found that both the closure (by including C→B and excluding C→B) are not
equivalent; hence FD C→B is important and cannot be removed from the set of FD.
Hence resultant FD = {B→A, AD→C, C→B, C→D}
6. (C)+
a) Closure (C)+ = {C,D,B,A} using FD = {B→A, AD→C, C→B, C→D}
b) Closure (C)+ = {C,B,A} using FD = {B→A, AD→C, C→B}
From 6 a and 6 b, we found that both the Closure( by including C→D and excluding C→D) are not
equivalent, hence FD C→D is important and cannot be removed from the set of FD.
Hence resultant FD = {B→A, AD→C, C→B, C→D}

Copyright © 2021, ABES Engineering College


Canonical Cover or Minimal Set of Functional
Dependency…
Example 1 (contd.)
Condition 3
Since FD = {B→A, AD→C, C→B, C→D} is resultant FD, now we have to check the redundancy of
attributes on LHS; since the left side of FD AD→C has two attributes, let us check their importance, i.e.,
whether they both are important or only one.
(AD)+ = {A,D,C,B} using FD = {B→A, AD→C, C→B, C→D}
(A)+ = {A} using FD = {B→A, AD→C, C→B, C→D}
(D)+ = {D} using FD = {B→A, AD→C, C→B, C→D}

Since the (AD)+, (A)+, (D)+ that we found are not all equivalent, hence in FD AD→C, both A and D are
important attributes and cannot be removed.
Hence resultant FD = {B→A, AD→C, C→B, C→D} and we can rewrite as
FD = {B→A, AD→C, C→BD} is Canonical Cover of FD = {B→A, AD→BC, C→ABD}.

Copyright © 2021, ABES Engineering College


Canonical Cover or Minimal Set of Functional
Dependency…
Example 2:
Find canonical cover for a relational Schema R(V,W,X,Y,Z) and set of FDs = {V→W, VW→X, Y→VXZ}.

Condition 1
Given FD = {V→W, VW→X, Y→VXZ} to be decomposed using Armstrong Axiom’s decomposition rule.
V→W
VW→X
Y→V ( using decomposition inference rule on Y→VXZ )
Y→X ( using decomposition inference rule on Y→VXZ )
Y→Z ( using decomposition inference rule on Y→VXZ )

Now set of FD = {V→W, VW→X, Y→V, Y→X, Y→Z}

Copyright © 2021, ABES Engineering College


Canonical Cover or Minimal Set of Functional
Dependency…
Example 2 (contd.)
Condition 2
Calculating closure of all FD {V→W, VW→X, Y→V, Y→X, Y→Z}
1. (V)+
a) Closure (V)+ = {V,W,X} using FD = {V→W, VW→X, Y→V, Y→X, Y→Z}
b) Closure (V)+ = {V} using FD = {VW→X, Y→V, Y→X, Y→Z}
From 1 a and 1 b, we found that both the Closure( by including V→W and excluding V→W) are not
equivalent; hence FD V→W is important and cannot be removed from the set of FD.
Hence resultant FD = {V→W, VW→X, Y→V, Y→X, Y→Z}
2. (VW)+
a) Closure (VW)+ = {V,W,X} using FD = {V→W, VW→X, Y→V, Y→X, Y→Z}
b) Closure (VW)+ = {V,W} using FD = {V→W, Y→V, Y→X, Y→Z}
From 2 a and 2 b, we found that both the Closure( by including VW→X and excluding VW→X ) are not
equivalent, hence FD VW→X is important and cannot be removed from the set of FD.
Hence resultant FD = {V→W, VW→X, Y→V, Y→X, Y→Z}

Copyright © 2021, ABES Engineering College


Canonical Cover or Minimal Set of Functional
Dependency…
Example 2 (contd.)
3. (Y)+
a) Closure (Y)+ = {Y,V,X,Z,W} using FD = {V→W, VW→X, Y→V, Y→X, Y→Z}
b) Closure (Y)+ = {Y,X,Z} using FD = {V→W, VW→X, Y→X, Y→Z}
From 3 a and 3 b, we found that both the Closure( by including Y→V and excluding Y→V ) are not
equivalent; hence FD Y→V is important and cannot be removed from the set of FD.
Hence resultant FD = {V→W, VW→X, Y→V, Y→X, Y→Z}
4. (Y)+
a) Closure (Y)+ = {Y,X,V,Z,W} using FD = {V→W, VW→X, Y→V, Y→X, Y→Z}
b) Closure (Y)+ = {Y,V,Z,W,X} using FD = {V→W, VW→X, Y→V, Y→Z}
From 4 a and 4 b, we found that both the Closure( by including Y→X and excluding Y→X ) are
equivalent; hence FD Y→X is not important and can be removed from the set of FD.
Hence resultant FD = {V→W, VW→X, Y→V, Y→Z}

Copyright © 2021, ABES Engineering College


Canonical Cover or Minimal Set of Functional
Dependency…
Example 2 (contd.)
5. (Y)+
a) Closure (Y)+ = {Y,Z,V,W,X} using FD = {V→W, VW→X, Y→V, Y→Z}
b) Closure (Y)+ = {Y,V,W,X} using FD = {V→W, VW→X, Y→V}
From 5 a and 5 b, we found that both the Closure( by including Y→Z and excluding Y→Z )
are not equivalent; hence FD Y→Z is important and cannot be removed from the set of FD.
Hence resultant FD = {V→W, VW→X, Y→V, Y→Z}

Copyright © 2021, ABES Engineering College


Canonical Cover or Minimal Set of Functional
Dependency…
Example 2 (contd.)
Condition 3
Since FD = {V→W, VW→X, Y→V, Y→Z} is resultant FD now, we have to check the redundancy of the
attributes on LHS; since the left side of FD VW→X has two attributes at its left, let us check their
importance, i.e., whether they both are important or only one.
(VW)+ = VWX using FD = {V→W, VW→X, Y→V, Y→Z}
(V)+ = VWX using FD = {V→W, VW→X, Y→V, Y→Z}
(W)+ = W using FD = {V→W, VW→X, Y→V, Y→Z}
Since the (VW)+, (V)+, (W)+, we found that all the Closures of VW and V are equivalent, hence in FD
VW→X, W is not at all an important attribute and can be removed.

Hence resultant FD = {V→W, V→X, Y→V, Y→Z} and we can rewrite as


FD = {V→WX, Y→VZ} is Canonical Cover of FD = {V→W, VW→X, Y→VXZ}

Copyright © 2021, ABES Engineering College


Question
Q. Consider a relation scheme R = (A, B, C, D, E, H) on which the following
functional dependencies hold: {A–>B, BC–> D, E–>C, D–>A}. What are the
candidate keys of R? [GATE 2005]

(a) AE, BE
(b) AE, BE, DE
(c) AEH, BEH, BCH
(d) AEH, BEH, DEH

Copyright © 2021, ABES Engineering College


Question
1. Let R= (A, B, C, D, E, F) be a relation scheme with the following dependencies: C->F,
E->A, EC->D, A->B. Which of the following is a key for R? (Gate-1999)

(a) CD
(b) EC
(c) AE
(d) AC

Copyright © 2021, ABES Engineering College


Question
Q Given the following relation instance. GATE-2000
-------
X Y Z
-------
1 4 2
1 5 3
1 6 3
3 2 2
-------
Which of the following functional dependencies are satisfied by the instance?
(a) XY -> Z and Z -> Y
(b) YZ -> X and Y -> Z
(c) YZ -> X and X -> Z
(d) XZ -> Y and Y -> X

Copyright © 2021, ABES Engineering College


Question
Q Consider a relation scheme R = (A, B, C, D, E, H) on which the following functional
dependencies hold: {A–>B, BC–>D, E–>C, D–>A}. What are the candidate keys of R?
GATE-2005

(a) AE, BE
(b) AE, BE, DE
(c) AEH, BEH, BCH
(d) AEH, BEH, DEH

Copyright © 2021, ABES Engineering College


Question
Q. In a schema with attributes A, B, C, D and E, following set of functional dependencies
are given:GATE-2005(IT)

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

Copyright © 2021, ABES Engineering College


Question
Q The following functional dependencies are given: GATE-2006

AB->CD, AF->D, DE->F, C->G , F->E, G->A

Which one of the following options is false?

(a)CF+ = {ACDEFG}
(b)BG+ = {ABCDG}
(c)AF+ = {ACDEFG}
(d)AB+ = {ABCDFG}

Copyright © 2021, ABES Engineering College


Question
Q 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?
GATE - 2014

(a) {E,F}
(b) {E,F,H}
(c) {E,F,H,K,L}
(d) {E}

Copyright © 2021, ABES Engineering College


Question
Q. A prime attribute of a relation scheme R is an attribute that appears . GATE 2014

(A) in all candidate keys of R.

(B) in some candidate key of R.

(C) in a foreign key of R.

(D) only in the primary key of R.

Copyright © 2021, ABES Engineering College


Question
Q Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values.
F={CH→G, A→BC, B→CFH, E→A, F→EG} is a set of functional dependencies (FDs) so
that F+ is exactly the set of FDs that hold for R.
How many candidate keys does the relation R have? GATE-2013

(A) 3

(B) 4

(C) 5

(D) 6

Copyright © 2021, ABES Engineering College


Thank You

92
Copyright © 2021, ABES Engineering College

You might also like