Databases Qualifying Examination
August 23rd, 1999 -- 1-3pm
1. [15 points] Suppose that you have entity sets ADVISOR and STUDENT. Explain how you can use functional dependencies to specify that there exists a m-1 relationship from students to advisors.
Answer:
2. [30 points]
a) Assume that we have a relation scheme
R=(A,B,C) and that the domains for A, B, and C have
n, m, and l elements, respectively.
How many relations defined on R can we have?
b) Suppose R is a relation with attributes
.
As a function of n, tell how many superkeys R has if
the only key is A1.
Answers: a)
.
b) All the subsets of R that contain A1: 2 n-1
3. [40 points]
Consider the relation scheme
R = (C, T, H, R, S, G),
the set of functional dependencies
,
and
the decomposition
.
a)
Prove that the functional dependency
is not preserved by the decomposition.
b) Prove that the decomposition is lossless with respect to F.
c) Prove that the decomposition is in 3NF with respect to F.
Answers: a) The following relation defined on CTHRSGproves it:
.
b) The chase procedure can be used to prove it. c) They have to prove that the decomposition is in BCNF and then argue that BCNF implies 3NF.
4 [15 points ]
Let R, S, and Tbe three ternary relations.
Write a Datalog program that defines the result
of the following relational algebra expression:
.
Answer:
ans(X,Y,Z) :- p1(X,Y,Z), p2(X,Y,Z).
,