You are on page 1of 7

Database Systems

Assignment 4
Total Marks: 100

Due Date: 27th Sep 2021


Related topics: FDs, Normalization
Instructions:
1. Assignment must be submitted on Portal
2. Late submission will cause you to lose 10% per day. After three days of deadline no submissions
will be entertained.
3. Refrain from copying other student’s assignments.

NAME: summaya
SECTION: A
REG NO: L1F19BSCS0559
Question 1: Find all the possible closures for the above relation and given
Functional Dependency set. Also identify the super keys. 25
R (A, B, C, D, E)
ABC CB DE BD ED BC

ANSWER:
1) First we change,
ABC
AB , AC using splitting rule
2) Now for closures:
i) ABCDE+= ABCDE Super key
ii) ABCD+=ABCDE Removing E (from D we get E) Super key
iii) ABC+=ABCDE Removing C (from B we get D) Super key
iv) AB+=ABCDE Removing C (from A we get C) Super key
v) A+=ABCDE Removing B (from A we get B) Super key
So the Super keys we get from short cut method are:
ABCDE+, ABCD+, ABC+, AB+, A+.
Note: You can do it in all different pairs made up with A as A+ is a Super Key above.
Question 2: Find the candidate keys in the following relations and FD. 5*7=35
i. AC CA BD ABE BCE
R(ABCDE)
ANSWER:
1. ABCDE+=ABCDE
2. AB+=ABCDE+ Removing CDE (from A, B we get C, D and from AB, BC we
get E)
So the Super key we get from short cut method is: AB+
Now for Candidate Key:
Taking AB+ closure, we have:
A+=AC
B+=BD
Hence, there is no super key in the subset of super key so, it’s a Candidate key.
Result: AB+ is both Candidate key and super key.
-------------------------------------------------------------------------------------------------------
---------
ii. ABEF AC BDGHI HI AEBDFGHI
R(ABCDEFGHI)
ANSWER:
First we change,
a) ABEF
ABE , ABF using splitting rule
b) AEBDFGHI
AEB , AED , AEF , AEG , AEH , AEI using splitting rule
c) BDGHI
BD , BG , BH , BI using splitting rule
Now for Super Key:
 Method 1:
1. ABCDEFGHI+=ABCDEFGHI
2. AB+=ABCDEFGHI Super key
Removing CDEFGHI (from AB we get EF and from A we get C and
from AE, B we get BDFGHI, DGHI)
For Candidate key:
Taking AB+ closure, we have:
A+=AC
B+=BDGHI
Hence, there is no super key in the subset of super key so, it’s a Candidate key.
Result: AB+ is both Candidate key and super key.
 Method 2:
1. ABCDEFGHI+=ABCDEFGHI
2. AE+=ABCDEFGHI Super key
Removing BCDFGHI (from AE we get BDFGHI and from A we get C
and from AB, B we get EF, DGHI)
For Candidate key:
Taking AE+ closure, we have:
A+=AC
E+=E
Hence, there is no super key in the subset of super key so, it’s a Candidate key.
Result: AE+ is both Candidate key and super key.
-------------------------------------------------------------------------------------------------------
---------
iii. AB BCE EDA R(ABCDE)
ANSWER:
1. ABCDE+=ABCDE
2. ACD+=ABCDE Removing BE (from A we get B and from BC we get E)
Super key
For Candidate key:
Taking ACD+ closure, we have:
A+=AB
C+=C
D+=D
AC+=ABCE
AD+=ABD
CD=CD
Hence, there is no super key in the subset of super key so, it’s a Candidate
key.
Result: ACD+ is both Candidate key and super key.
----------------------------------------------------------------------------------------------
--------
iv. ABC BCD CDA R(ABCD)
ANSWER:
 Method 1:
1. ABCD+=ABCD
2. AB+=ABCD Removing CD (from AB we get C and from BC we get D)
Super key
For Candidate key:
Taking AB+ closure, we have:
A+=A
B+=B
Hence, there is no super key in the subset of super key so, it’s a Candidate
key.
Result: AB+ is both Candidate key and super key.
 Method 2:
1. ABCD+=ABCD
2. BC+=ABCD Super key
Removing AD (from BC we get D and from CD we get A)
For Candidate key:
Taking BC+ closure, we have:
B+=B
C+=C
Hence, there is no super key in the subset of super key so, it’s a Candidate
key.
Result: BC+ is both Candidate key and super key.
----------------------------------------------------------------------------------------------
--------
v. ABCDCA R(ABCD)
ANSWER:
First we change,
ABCD
AB, AC , AD using splitting rule
 Method 1:
1. ABCD+=ABCD
2. A+=ABCD Removing BCD (from A we get BCD and from C we get A)
Super key
Result: A+ is both Candidate key and a super key.
 Method 2:
1. ABCD+=ABCD
2. C+=ABCD Removing ABD (from C we get A and from A we get BCD)
Super key
Result: C+ is both a Candidate key and a super key.
-------------------------------------------------------------------------------------------------------
---------
vi. ABC CD BEA R(ABCDE)
ANSWER:
First we change,
BEA
BE, BA using splitting rule
Now for Super key:
 Method 1:
1. ABCDE+=ABCDE
2. B+=ABCDE Super key
Removing ACDE (from B we get EA and from AB we get C and from C we get
D)
Result: B+ is both a Candidate key and a super key.

 Method 2:
1. ABCDE+=ABCDE
2. AB+=ABCDE Super key
Removing CDE (from AB we get C and from C we get D and from B we
get EA)
For Candidate key:
Taking AB+ closure, we have:
A+=A
B+=ABCDE
Hence, there is a super key in the subset of super key so, it’s not a Candidate
key.
Result: AB+ is not a Candidate key and but a super key.
-------------------------------------------------------------------------------------------------------
---------
vii. ABE CBE CD EF R(ABCDEF)
ANSWER:
First we change,
a. ABE
AB , AE using splitting rule
b. CBE
CB , CE using splitting rule
For Super key:
1. ABCDEF+=ABCDEF
2. AC+=ABCDEF Super key
Removing BDEF (from A, C we get BE and from C we get D and from
E we get F)
For Candidate key:
Taking AC+ closure, we have:
A+=ABEF
C+=BCDEF
Hence, there is no super key in the subset of super key so, it’s a Candidate
key.
Result: AC+ is both Candidate key and super key.
---------------------------------------------------------------------------------------------------------------------
----

Question 3: Calculate the normalization of following Relation and using FD


parts? 30
R(ABCDEFGHIJKLMNOP)
ABCD EFGHI JKLM NOAE NIP
ANSWER:

Question 4: Find the minimal cover of the set of functional dependencies for
the Relation? (Marks 10)

R (A, B, C, D, E, I);
{A → C, AB → C, C → DI, CD → I, EC → AB, EI → C}

ANSWER:

Let we have F = {A  C, AB  C, C  DI, CD  I, EC  AB, EI  C}


Now by applying the rules:
1. Splitting the Right Hand Side (RHS) of all FD’s:
a. CDI
CD, CI using splitting rule
b. ECAB
ECA , ECB using splitting rule
Now from F let’s take F1 as fellows by the rule 1 then we have:
F1 = {A  C, AB  C, C  D, C  I, CD  I, EC  A, EC  B, EI  C}
2. Removing Extraneous Attributes:
In the set of FDs, AB  C, CD  I, EC  A, EC  B, and EI  C have more than one
attribute in the LHS. Hence, we check one of these LHS attributes are extraneous or not.
For this let’s find out the closure of each attribute on the LHS:
i. A+ = ACDI
ii. B+ = B
iii. C+ = CDI
iv. D+ = D
v. E+ = E
vi. I+ = I
From i: we have seen that the closure of A included the attribute C. So, B is extraneous in AB
C, and B can be removed.
From iii: we have seen that the closure of C included the attribute I. So, D is extraneous in CD
 I, and D can be removed.
As there are no more extraneous attributes are left. Hence, we change F1 as F2 after removing
extraneous attributes from F1 as follows:
F2 = {A  C, AC, C  D, C  I, CD, EC  A, EC  B, EI  C}
3. Eliminate Redundant Functional Dependency:
For this let’s remove duplicate 1st So F2 becomes:
F2 = {AC, C  D, C  I,EC  A, EC  B, EI  C}
Now here we seen that from 2nd rule we have seen in closure that C can be determined using
AC. SO, EIC becomes redundant.
Now by removing EIC ,the Minimal Cover is :
Minimal Cover = Fc = {A  C, C  D, C  I, EC  A, EC  B}

You might also like