Professional Documents
Culture Documents
Normalization
Solutions
Linked Question:
1. Common Data:
A relation R is given as
(ii) If the above relation is converted into 1NF, what will be the no. of rows in the resulting
relation? (Assume we can create only one relation)
(a) 9 (b) 7
(c) 8 (d) 6
Explanation:
(i) As the relation contains multivalued attribute phoneNo, the relation is in un-normalized form.
(ii) First Normal form does not allow multivalued attributes. So, the given table should be
converted as
1
Eid Ename PhoneNo
1 Rakesh 9980734567
1 Rakesh 9524312988
2 Ram 8798214587
2 Ram 08632374568
3 Ravi 988765340
3 Ravi 040225678
So, the number of tuples after converting the given table to 1NF is 6. So, answer is (d) 6.
2. Given relation R(ABCDE) with FD set 𝐹 = {𝐴𝐵 → 𝐶𝐷𝐸, 𝐴 → 𝐶, 𝐸 → 𝐴𝐵}. What is the
normal form of the above relation?
Explanation:
Given:
∴ 𝐸 𝑖𝑠 𝑐𝑎𝑛𝑑𝑖𝑑𝑎𝑡𝑒 𝑘𝑒𝑦.
Then try for all combinations of two attributes like (AB), (BC), (CD), (AD), (BD)… (Need not
try the combination with E as E is candidate key, any combination with E will become
superkey).
Similarly, try for all combinations of three attributes like (𝐵𝐶𝐷), (𝐴𝐶𝐷) (need not try the
combination with E and AB as E and AB are already candidate keys and any combination with
them will become superkey), but no combination attributes closure determines all attributes. So
2
they are no candidate key with three attributes. We cannot form any four attribute combination
without using AB and E, so no need to try for that combination. Therefore candidate keys for
given relation R(ABCDE) are A, BE. This means A, B, E are prime attributes. C, D are non-
prime attributes.
We know that a relation R is said to be in 2NF, only if they are no partial dependencies in it.
Partial dependency is nothing but the part of a key determining non-prime attribute. So, we
check whether any partial dependencies are present in given relation R.
FD② is partial dependency as left side of FD i.e. A is part of key (AB) and is determining non-
prime attribute C. 𝐴 (𝑝𝑎𝑟𝑡 𝑜𝑓 𝑡ℎ𝑒 𝑘𝑒𝑦) → 𝐵(𝑛𝑜𝑛 𝑝𝑟𝑖𝑚𝑒 𝑎𝑡𝑡𝑟𝑖𝑏𝑢𝑡𝑒).
3. Given relation R (ABCD) with BD as primary key. Which functional dependency violates
3NF?
(a) 𝐴 → 𝐶 (b) 𝐵 → 𝐷
(c) 𝐵𝐷 → 𝐴 (d) 𝐵𝐷 → 𝐶
Explanation:
Formal definition of 3NF states that for every non-trivial FD 𝑋 → 𝑌 𝑖𝑛 𝑅, either X is a Superkey
in R or Y is a prime attribute.
4. The highest normal form of the relation R(A, B, C, D) if the following FD’s are satisfied by
relation:
𝐹: {𝐴𝐵 → 𝐷, 𝐴𝐶 → 𝐵𝐷, 𝐵 → 𝐶}
Explanation:
A is not there in right hand side of any FD, So A is necessary in every candidate key, so check
for, (𝐴)+ , (𝐴)+ = 𝐴. As (𝐴)+ does not determine all attributes, Therefore A is not sufficient.
∴ 𝐴 𝑖𝑠 𝑛𝑜𝑡 𝐶𝑎𝑛𝑑𝑖𝑑𝑎𝑡𝑒 𝑘𝑒𝑦, but A should be definitely present in every candidate key.
Try for combination of 3 attributes including A but excluding AB, AC. There is no such
combination. So, need not to try for 3 attributes combination.
∴ Candidate key for given relation R are AB, AC.
∴ A, B, C are prime attributes. D is non-prime attribute.
Given FD’s:
𝐴𝐵 → 𝐷 ------>①
𝐴𝐶 → 𝐵𝐷 ------>②
𝐵→𝐶 ------>③
4
A relation R violates 2NF if and only if any partial dependencies are present in R. Partial
dependency means part of the key, determining non-prime attribute.
FD③is not partial dependency since left hand side of FD i.e B is part of key but C which is on
right hand side of FD is a prime attribute. So ③ is not partial dependency.
∴ Relation R satisfies 2NF.
In FD③, left hand side of FD i.e. B is not superkey, but right hand side of FD i.e. C is prime
attribute.
∴ 𝐹𝐷③ satisfies 3NF.
∴ Given relation R satisfies 3NF.
FD③ does not satisfies BCNF, since left side of FD i.e. B is not Superkey
5
(c) In a foreign key of R
Explanation:
A prime attribute is an attribute that appears in some candidate key of given relation R.
For eg: In relation R(ABCDE), if candidate keys are A, BC then prime attributes are A, B, C.
For (StudentName, StudentAge) to be a key for this instance, the value X should not be equal to
(a) 18 (b) 19
Explanation:
Given, for STUDENTS relation, {StudentName, StudentAge} is key. It means for every tuple
the combination of these two columns is unique. So the combination {Sowmya, 19} should not
repeat in table. Therefore, X value should not be 19.
(i) Above relation can be decomposed into 2NF without violating dependency preservation.
(ii) Above relation can be decomposed into 3NF without violating dependency preservation.
6
Solution: Option (a)
Explanation:
FD② is not partial dependency since left hand side of FD i.e. BC is not part of key (B, C are
non-prime attributes).
FD③is not partial dependency since left hand side of FD i.e. D is not part of key (D is non-
prime attribute).
Shortcut: If there is only one prime attribute or all the candidate keys contain only one attribute
then R is in 2NF and every 2NF decomposition is FD preserving.
So, statement (i) is correct.
FD② does not satisfy 3NF since left side of FD i.e. BC is not Superkey and right side of FD i.e.
D is non-prime attribute.
(𝐵𝐶)+ = 𝐵𝐶𝐷𝐸
7
Here in relation R(BCDE) D⟶E FD violates 3NF
(∵ D is not Superkey and E is not prime attribute)
We can say that this can cover the original FD set {𝐴 → 𝐵𝐶, 𝐵𝐶 → 𝐷, 𝐷 → 𝐸}.So given relation
R can be decomposed into 3NF without violating FD preserving.
So, statement II is correct.
Answer is (a).
Shortcut: We know that every 2NF decomposition and 3NF decomposition is lossless and FD
preserving. So option (a) is correct.
Linked Question
Common Data:
(a) 1 (b) 2
(c) 3 (d) 4
8
(a) 1NF (b) 2NF
Explanation:
𝐴 → 𝐵𝐶 ------>①
𝐶 → 𝐷 ------>②
𝐸 → 𝐹𝐺 ------>③
𝐻 → 𝐼𝐽 ------>④
Answer is (a).
FD① is partial dependency since left side of FD i.e. A is part of key determining non-prime
attributes B, C.
9. Consider the relation schema of the relation SCHEDULE shown below. What is the highest
normal form of this relation?
9
Assume the following functiuonal dependencies
Stud_ID⟶Stud_Name
Stud_ID⟶Stud_Major
Class ⟶Class_Time
Class ⟶ Building, Room
Class ⟶ Instructor
Explanation:
Stud_ID, class is not there in right hand side of any FD. So Stud_ID, class are necessary in every
candidate key. Check whether Stud_ID, class itself is sufficient or not by finding
(𝑆𝑡𝑢𝑑_𝐼𝐷, 𝐶𝑙𝑎𝑠𝑠)+.
As
(𝑆𝑡𝑢𝑑_𝐼𝐷, 𝐶𝑙𝑎𝑠𝑠)+ =
𝑆𝑡𝑢𝑑_𝐼𝐷 𝑆𝑡𝑢𝑑_𝑁𝑎𝑚𝑒 𝑆𝑡𝑢𝑑_𝑀𝑎𝑗𝑜𝑟 𝐶𝑙𝑎𝑠𝑠 𝐶𝑙𝑎𝑠𝑠_𝑇𝑖𝑚𝑒 𝐵𝑢𝑖𝑙𝑑𝑖𝑛𝑔, 𝑅𝑜𝑜𝑚, 𝐼𝑛𝑠𝑡𝑟𝑢𝑐𝑡𝑜𝑟.
So, Stud_ID, Class are necessary and sufficient, no need to try for other combinations.
So, Candidate key is (Stud_ID, Class). Stud_ID, Class are prime attributes. Stud_Name,
Stud_Major, Class, Class_Time, Building, Room and Instructor are non-prime attributes.
All FD’s in given relation R are partial dependencies. Here left sides of FD’s i.e. Stud_ID, Class
are part of key determining non-prime attributes.
The highest normal form satisfied by R is 1NF. So, answer is Option (d).
10
(c) D is a key for R (d) CD is a key
Explanation:
11. Consider the relational schema 𝑅(𝐴𝐵𝐶𝐷𝐸𝐹𝐺𝐻) and the FD’s {𝐴 ⟶ 𝐵𝐶, 𝐶 ⟶ D, E ⟶
A, F ⟶ GH}. Is the decomposition of R into (𝐸𝐴𝐵𝐶𝐷)(𝐹𝐺𝐻)(𝐸𝐹) is
I. Lossless
II. Lossy
III. Dependency preserving
IV. Not dependency preserving
Explanation:
and decomposed tables are (EABCD) (FGH) (EF). So the FD’s can be divided as
11
Finding Candidate key for (EABCD):
E is not there in right hand side of any FD so E is necessary in every candidate key. Check
whether E itself is sufficient to be a candidate key. As (𝐸)+ = 𝐸𝐴𝐵𝐶𝐷 , E is determining all
attributes in R, we can say E is necessary and sufficient, so E is only candidate key for EABCD.
F is not present in right hand side of any FD so F is necessary in every candidate key. Check
whether F itself is sufficient to be a candidate key. As (𝐹)+ = 𝐹𝐺𝐻 , F is determining all
attributes in R, we can say F is necessary and sufficient, so F is only candidate key for FG.
Candidate key for (EF) is EF as they are no FD’s under it.
So, the decomposed tables are
Here between EABCD and EF the common attribute is E which is key for EABCD and also the
common attribute between FGH and EF is F which is key in FGH. So, the above decomposition
is lossless, and there are no spurious tables, when we perform natural join on these tables.
Here if we want to join tables EABCD and FGH, first we combine tables EABCD and EF and
then we combine the resultant table with FGH. So, with given E value, we can find F value from
final table.
Original FD set:
{𝐴 → 𝐵𝐶, 𝐶 → 𝐷, 𝐸 → 𝐴, 𝐹 → 𝐺𝐻}
It is clear that original FD set and final FD set after decomposition is same.
12
∴Given decomposition is lossless and FD preserving.
So, answer is (a).
12. R(ABCD) is a relation. Which of the following FDs while holding on ‘R’ does not have
either lossless join or dependency preserving BCNF decomposition?
Explanation:
13
The above decomposition is lossless (∵ common attribute of AB and AC is A and A is candidate
key in AB, common attribute of CD and AC is C and C is key in CD)
This decomposition is also FD preserving (∵ Final FD set {A⟶B, C⟶D} covers original FD set
{A⟶B, C⟶D}
∴ Given FD’s in relation R has lossless and FD preserving BCNF decomposition.
So, option (a) is not answer.
A, B are not there in right hand side of any FD, so A, B are necessary in every candidate key.
Check whether AB is sufficient itself to be a candidate key, so find (𝐴𝐵)+ = 𝐴𝐵𝐶𝐷. As (𝐴𝐵)+
is determining all attributes we can say AB is necessary and sufficient, no need to check for other
combinations to find Candidate key. AB is the only candidate key of R
FD① is satisfying BCNF (∵ AB is Superkey in R)
14
So table ABCD can be decomposed as
All tables CD, BC, AB are satisfying BCNF (∵ C is key in CD and B is key in BC).
Decomposition is also FD preserving since FD’s {C⟶D, B⟶C} which are final FD’s after
decomposition can cover original FD set {AB⟶C, B⟶C, C⟶D}. It seems AB⟶C is not
present in final FD set but if we find (𝐴𝐵)+ in final FD set
(𝐴𝐵)+ = 𝐴𝐵𝐶𝐷 ⟹ 𝐴𝐵 ⟶ 𝐶
So 𝐴𝐵 ⟶ 𝐶 which is present in original FD set can be covered by final FD set obtained after
decomposition.
So, given FD’s has lossless and FD preserving BCNF decomposition.
A is not there in right hand side of any FD, so A is necessary in every candidate key. Check
whether A itself is sufficient to be a candidate key, so find (𝐴)+ = 𝐴𝐵𝐶𝐷. As (𝐴)+ is
determining all attributes we can say A is necessary and sufficient, no need to check for other
combinations to find Candidate key. A is the only candidate key of R
15
FD② satisfies BCNF, since left side of FD i.e. A is Superkey in R.
B is not there in right hand side of any FD, so B is necessary in every candidate key. Check
whether B itself is sufficient to be a candidate key. As (𝐵)+ = 𝐵, B is not a key.
Check for combination of 2 attributes including B like AB, BC, BD and find closures of them.
Only (𝐴𝐵)+ = 𝐴𝐵𝐶𝐷 and (𝐵𝐶)+ = 𝐵𝐶𝐴𝐷
∴ AB, BC are Candidate keys.
Check for combination of three attributes including B but excluding BA, BC ( As AB and AC
are already candidate keys , so any combination with them will become superkey) . There are no
such combinations. So, no need to check for them.
∴ AB, AC are Candidate keys for given relation R.
FD② does not satisfy BCNF (∵left side of FD i.e. C is not Superkey)
So find (𝐶)+ :
(𝐶)+ = 𝐶𝐴
New tables CA and BCD are satisfying BCNF decompositions since C is Superkey in CA.
It is also lossless decomposition since common attribute of tables CA and BCD is C which is key
for table CA.
16
It is not FD preserving, since final FD set {𝐶 → 𝐴}cannot cover original FD set {𝐴𝐵 → 𝐶𝐷, 𝐶 →
𝐴} because if we find (𝐴𝐵)+ in {𝐶 → 𝐴}(𝐴𝐵)+ = 𝐴𝐵
13. Given R = ABCDE and FD set {𝐴𝐵 → 𝐶𝐷, 𝐸 → 𝐴, 𝐷 → 𝐸}. If we decompose into BCNF,
how many tables we will get?
(a) 2 (b) 3
(c) 4 (d) 5
Explanation:
B is not there in right hand side of FD’s, so find (𝐵)+ = 𝐵. So, B is not Candidate key.
Try for all combinations of two attributes including B such as BA, BC, BD, BE.
Only (𝐵𝐴)+ = 𝐵𝐴𝐶𝐷𝐸, (𝐵𝐸)+ = 𝐵𝐸𝐴𝐶𝐷, (𝐵𝐷)+ = 𝐵𝐷𝐸𝐴𝐶. So AB, BE, BD are Candidate
keys. Now try for the combinations of all three attributes including B but excluding BA,BE, BD .
There are no such combinations, so need to try for that.
FD② is not satisfying BCNF, since left side of FD i.e. E is not Superkey.
∴ Find (𝐸)+ = 𝐸𝐴
17
ABCDE can be decomposed as
Here table EA is satisfying BCNF, but table BCDE is not satisfying BCNF since left side of FD
(D⟶E) i.e. D is not Superkey. So find (𝐷)+ = 𝐷𝐸
So, the final decomposition of R(ABCDE), such that decomposed tables satisfying BCNF is
Answer is (b).
14. From the following instance of a relation schema R(A, B, C) we can conclude that
A B C
𝑎1 𝑏1 𝑐1
𝑎1 𝑏1 𝑐2
𝑎2 𝑏2 𝑐3
𝑎2 𝑏2 𝑐3
18
(b) A functionally determines B and B does not functionally determines C.
(d) A does not functionally determines B and B does not functionally determines C.
Explanation: FDs are decided from the requirement analysis phase first, then tables are formed
using FDs and normalization. So from given instance of a relation schema we can only say that
certain FDs do not hold, but cannot say which FDs hold on R, because even if an FD holds on
the current instance, it may not hold as the table grows.
From the given instance we can only say that B functionally does not determines C because for
given b1 of B, C has c1 and c2 values, but we cannot say that A functionally determines B for
the entire relation itself. This is because A → B holds for this instance, but in future there might
be some tuples added to the instance that may violate A→B.
∴ C is Answer.
(b) Any relation in which every key has only one attribute is in 2NF.
Explanation:
In BCNF, a prime attribute should not transitively dependent on a key, as every determinant
should be a Superkey in BCNF.
A is not there in right hand side of any FD, so A is necessary in every candidate key. Check for
A is sufficient itself to be a candidate for R. So check for𝐴+ . As 𝐴+ = A, A is not determining all
attributes. Therefore A is not candidate key. Try for all two combination attributes including A.
We have to try AB, AC. AB and AC are candidate keys since (𝐴𝐵)+ = ABCD and (𝐴𝐶)+ =
19
ABCD. Now try for three combination attributes including A but excluding AB and AC (AB I
and AC are already candidate keys, so any combination with AB and AC will become superkey).
Therefore AB and AC are the only candidate keys in R. A, B, C are prime attributes.
But C→B is not in BCNF, since C is not superkey in R. Here the prime attribute ‘B’ is
transitively depending on key ‘AB’ and is not satisfying BCNF. So we can say “A prime
attribute cannot be transitively dependent on a key in BCNF “.
Explanation:
Given FD’s A→ 𝐵
𝐵𝐶 → 𝐷
𝐸→𝐶
𝐷→𝐴
E, H are not present in right hand side of any FD, so E, H are necessary in every candidate key.
Check whether E, H is sufficient itself to be a candidate key for R. So find (𝐸𝐻)+ . As (𝐸𝐻)+ =
𝐸𝐻𝐶, So EH is not Candidate key.
Try the combination of 3 attributes including EH like
AEH, BEH, CEH, DEH
Try for combination of 4 attributes including EH but excluding AEH, BEH, DEH.
There is no such combination.
20
∴ 𝐴𝐸𝐻, 𝐵𝐸𝐻, 𝐷𝐸𝐻 𝑎𝑟𝑒 𝑡ℎ𝑒 𝑜𝑛𝑙𝑦 𝐶𝑎𝑛𝑑𝑖𝑑𝑎𝑡𝑒 𝑘𝑒𝑦𝑠. 𝑆𝑜 𝑂𝑝𝑡𝑖𝑜𝑛 (𝑏) 𝑖𝑠 𝑎𝑛𝑠𝑤𝑒𝑟.
Explanation:
FD②, FD③ are satisfying 2NF as they are not partial dependencies.
Shortcut: If there is only one prime attribute or all the candidate keys contain only one attribute
then R is in 2NF.
FD② violates 3NF since left side of FD i.e. C is not Superkey and right side of FD i.e. D, E are
not prime attributes.
21
∴ 𝑅𝑒𝑙𝑎𝑡𝑖𝑜𝑛 𝑅 𝑣𝑖𝑜𝑙𝑎𝑡𝑒𝑠 3𝑁𝐹.
∴ 𝐺𝑖𝑣𝑒𝑛 𝑟𝑒𝑙𝑎𝑡𝑖𝑜𝑛 𝑅 𝑖𝑠 𝑖𝑛 2𝑁𝐹.
Explanation:
Formal definition of BCNF states that for every non-trivial FD X⟶Y in R, X should be
Superkey in R.
Decomposed table ABE is in BCNF, since left side of all FD’s is Superkey (∵ A is key is ABE)
Decomposed table ACD is not in BCNF, Since left side of FD C⟶D i.e. C is not Superkey in
ACD (∵ AC is key in ACD)
22
∴ACD can be decomposed as
(b) lossy
Explanation:
23
A decomposition of a relation 𝑅 < 𝑆, 𝐹 > into relation schemas 𝑅𝑖 (1 ≤ 𝑖 ≤ 𝑛) is said to be a
lossless join decomposition or simply lossless if for every relation state r of R that satisfies FD in
F, the natutal join of the projections of R gives the original relation R i.e. R should be equal to
20. Given R=ABCDE and FD’s :{𝐴𝐵 → 𝐶𝐷𝐸, 𝐶 → 𝐴, 𝐷 → 𝐸}. If we decompose into BCNF, it is
FD preserving.
Explanation:
In the same way, try for combination of three attributes candidate keys including B but excluding
AB and AC (Since AB and AC are candidate keys any combination with them will become super
key). We have to try BDE. Find(𝐵𝐷𝐸)+ . As (𝐵𝐷𝐸)+ = BDE. BDE is not candidate key as BDE
is not determining all attributes. Try for combination of four attribute candidate keys including B
but excluding AB and BC, but there are no such combinations. So the candidate keys for the
given relation is AB, AC. Therefore A,B,C are prime attributes and D,E are non prime attributes.
24
We know that a relation R is said to be in BCNF if in every non-trivial FD X⟶Y in R, X is a
Superkey in R.
① is in BCNF (∵ AB is Superkey)
So find (𝐶)+ = 𝐶𝐴
Here table BCDE is not in BCNF (∵ left side of FD D⟶E i.e. D is not Superkey in BCDE
because BCD is key in BCDE)
25
Final FD set :{𝐶 → 𝐴, 𝐷 → 𝐸}
(𝐴𝐵)+ = 𝐴𝐵
26