DBMS W06 Pas
DBMS W06 Pas
Week 6
1. Consider the relational schema R(A, B, C, D, E), where the domains of A, B, C, D and
E include only atomic values. Identify the possible set of functional dependencies that
R can have such that R is in BCNF.
[MSQ: 2 points]
√
FD: {AB → CDE}
FD: {AB → CD, B → E}
FD: {AB → CD, C → D, D → E}
FD: {AB → CDE, D → A, E → B}
Thus, these two FDs violate 3NF rules. So, R is in 2NF but not in 3NF based on
this set of FDs.
Option-4: FD: {AB → CDE, D → A, E → B}
The candidate keys are: AB and DE as (AB)+ = {ABCDE} and (DE)+ =
{ABCDE}. The prime attributes are A, B, D, E.
There is no partial functional dependency. Thus, it is already in 2NF.
AB → CDE, where AB is superkey.
For D → A, E → B R.H.S of the functional dependencies are prime attributes.
Thus, it is in 3NF. However, These two FDs do not satisfy BCNF (as L.H.S are not
superkeys). So, R is in 3NF but not in BCNF based on this set of FDs.
Page 2
2. Consider the relational schema R(A, B, C, D, E, F ), where the domains for A, B, C, D, E
and F include atomic values only. If R satisfies the functional dependencies {AB →
CDE, E → F, BF → A, C → B}, then identify the correct statement(s).
[ MSQ: 2 points]
R is in 1NF but not in 2NF
√
R is in 2NF and also in 3NF
√
R is in 3NF but not in BCNF
R is in 3NF also in BCNF
Solution:
Candidate keys are: AB, BF, AC, BE, CF and CE. So, prime attributes are: A, B, C, E
and F . For the FDs: E → F and C → B, B and F are prime attributes. Thus,
there is no partial dependency, thus R is in 2NF.
AB → CDE and BF → A, as AB and BF both are candidate keys, the FDs are in
3NF.
C → B and E → F also in 3NF, since B and F are prime attributes. Thus, R is in
3NF.
C → B and E → F violate BCNF conditions as C and E are not superkeys. Thus,
R is not in BCNF.
Page 3
3. Consider the relational schema Z(P, Q, R, S ) and the following functional dependencies
on Z. [ MCQ: 2 points]
• P → QRS
• Q→R
• RS → P
Solution: FD = {P → QRS, Q → R, RS → P }
P + = PQRS
RS + = PQRS
QS + = PQRS
So, candidate keys are P, QS & RS and prime attribute are P, Q, R & S.
Since the schema Z has no partial dependencies or transitive dependencies, so it is
in 3NF.
Page 4
4. Let R(P,Q,R,S,T,U,V,W ) be a relation (all attributes have atomic values only) with
the following functional dependencies:
• {P Q → RST U }
• {P → R}
• {Q → S}
• {R → U V }
• {V → W }
• {W → U }
• {V → U }
Solution: Since all attributes in R have atomic values, it follows that R is in 1NF.
In order to check if R is in 2NF, we must find the candidate keys. Using the given
FDs, we find that PQV is the only candidate key. Hence P, Q and V are the prime
attributes and the rest are non-prime.
Now due to the presence of partial dependency, the relation R is not in 2NF.
Page 5
5. Consider the instance of relation Course given in Figure 1. [ MSQ: 2 points]
Which among the following multivalued dependencies can be inferred from the given
information?
√
course name →→ instructor
course name →→ book
course name →→ edition
√
course name →→ book, edition
Solution:
Let us first number the tuples as t1 , t2 , · · · , t10 .
Test for course name →→ instructor:
In relation Course, there exist two tuples t1 and t2 such that
t1 [course name] = t2 [course name].
We also have two tuples t3 and t4 in Course with the following properties:
Page 6
• t5 [instructor] = t6 [instructor] = t7 [instructor] and
t8 [instructor] = t9 [instructor] = t10 [instructor],
Page 7
6. Consider the relational schema:
Intern(intern code, intern name, project, hobby).
An intern can work in several projects and can have several hobbies. However, it main-
tains the FD: intern code → intern name.
Identify the most appropriate 4NF decomposition for the given schema.
[ MCQ: 2 points]
R1(intern code, intern name, project, hobby), R2(intern code, project, hobby)
R1(intern code, intern name, project), R2(intern code, hobby)
R1(intern code, intern name, hobby), R2(intern code, project)
√
R1(intern code, intern name), R2(intern code, project), R3(intern code, hobby)
Solution:
From the given information in the question, intern code cannot be a super key for
the given relation. Thus, intern code → intern name violates BCNF conditions.
Thus, a possible BCNF decomposition would be:
R1(intern code, intern name), where intern code is the candidate key, and
R2(intern code, project, hobby).
R2 violates 4NF conditions as it has the following MVDs:
intern code →→ project, and
intern code →→ hobby
So the 4NF decomposition is:
R2(intern code, project), and
R3(intern code, hobby).
Thus, the 4NF decomposition is:
R1(intern code, intern name),
R2(intern code, project),
R3(intern code, hobby).
Page 8
7. Let S(Y, U, V ) be a relation. Let R(P, W, X, Y, Z ) be another relation with the
following functional dependencies:
F = {X → ZW, Y → X, W → P }
R contains 300 tuples and S contains 250 tuples. What is the maximum number of
tuples possible as output of R o
n S?
[ MCQ: 2 point]
75000
√
250
300
50
• All 250 values of Y in S are same and there is an entry in R that matches with
this value. In this case, we get 250 tuples in output.
• All 100 values of Y in S are different and these values are present in R also.
In this case also, we get 250 tuples.
Page 9
8. Let A(T,U,V,W ) be a relational schema with the following functional dependencies:
F = {W → U T, U V → W, V → T, W → U }
It is given that A is not in BCNF.
Suppose A is decomposed into two relational schemas, B(TV ) and C(UVW ).
Which of the following statement(s) is/are correct?
[ MSQ: 2 points]
Decomposition of schema A into B and C is dependency preserving
√
Decomposition of schema A into B and C is lossless
Both B and C are in BCNF
√
Relation B is in BCNF
Solution:
Page 10
9. Consider the relational schema:
prescription(doctor id, doctor name, patient id, patient name, medicine id, medicine name),
where the domains of all the attributes consist of atomic values. Consider the following
FDs for the relation department.
[ MCQ: 2 points]
From among the decompositions given, identify the one that is in 4NF.
(doctor id, doctor name),
(patient id, patient name),
(medicine id, medicine name),
(doctor id, doctor name),
(patient id, patient name),
(medicine id, medicine name),
(doctor id, patient id, medicine id)
(doctor id, doctor name, patient id, patient name),
(doctor id, doctor name, medicine id, medicine name)
√
(doctor id, doctor name),
(patient id, patient name),
(medicine id, medicine name),
(doctor id, patient id),
(doctor id, medicine id)
Solution: For the given relation, the candidate key is {doctor id, patient id, medicine id}
and it is in 1NF. However, it is not in 2NF as the FDs:
doctor id → doctor name,
patient id → patient name,
medicine id → medicine name, are partial functional dependencies. Thus, a possi-
ble decomposition is:
R1(doctor id, doctor name), where doctor id is the candidate key,
R2(patient id, patient name), where patient id is the candidate key,
R3(medicine id, medicine name), where medicine id is the candidate key,
R4(doctor id, patient id, medicine id), where {doctor id, patient id, medicine id} is
the candidate key,
R1, R2, R3 and R4 are already in 3NF and BCNF.
Page 11
R1, R2 and R3 are already in 4NF. The MVDs,
doctor id →→ patient id, and
doctor id →→ medicine id violate 4NF conditions. Thus, R4 is decomposed as:
R41(doctor id, patient id) and
R42(doctor id, medicine id).
Thus, the 4NF decomposition is:
R1(doctor id, doctor name),
R2(patient id, patient name),
R3(medicine id, medicine name)
R41(doctor id, patient id) and
R42(doctor id, medicine id).
Page 12
10. Consider the relational schema R as:
R(A, B, C, D, E, F, G, H), where the domains of all the attributes consist of atomic
values. Consider the following FDs for the relation department.
• A → D,
• D → EF ,
• BH → CG,
• G → H,
From among the decompositions given, identify the one that is in BCNF.
[ MCQ: 2 points]
Page 13
11. Which of the following statements is/are true regarding temporal relations?
[ MSQ: 2 points]
Solution:
• An uni-temporal relations has one axis of time, either valid time or transaction
time.
• A bi-temporal relation has both axis of time, valid time and transaction time.
It includes valid start time, valid end time, transaction start time, transaction
end time.
Page 14