Anda di halaman 1dari 3

CS122A:

Introduction to Data Management


Quiz 4



Taken by:



Graded by:





Winter 2015
_____________________
Score (out of 10)

_______________________________________________
Name

_______________________________
Student ID

_______________________________________________
Name

_______________________________
Student ID

You will have 15 minutes to finish this quiz.

1. Name two reasons why database designers would avoid storing redundant data. 2
points

Waste of storage space / memory
More complicated to update
Update anomalies

2. At AB&C, we store the unique customer id (field Customer.ID) of the customer who
referred a new customer in Customer.ReferredBy. Which functional dependency
does this imply? 1 point

If we have two customer records with the same ID, then they will have been referred
by the same customer (b/c they are the same customer). If two records have the
same ReferredBy value, their IDs may be different (b/c one customer may refer two
others). Thus:

3. AB&C stores all invoices for contracts in the Invoice table. For convenience,
customers only receive one invoice a month. It contains the columns CustomerID,
Currency, Amount, and DateSent. State a candidate key for Invoice. 1 point

(CustomerId, DateSent)

4. Consider the following functional dependencies: , , . On
which of the following is E functionally dependent? - 2 points
(a) AB
(b) BC
(c) AC
(d) CE

CS122A: Introduction to Data Management

Winter 2015


5. Name the lowest normal form that the following violates. - 2 points

(a) ; ,
_____________________ (BCNF, Key AB)

1NF: It does not mention anything about non-atomic values, so 1NF is not
violated.
2NF: No dependencies on partial keys. AB is full key (so the first FD is ok), C is
not part of a key (so the second FD does not violate 2NF)
3NF: is a transitive dependency however, 3NF only deals with
transitive dependencies to non-prime attribute. As A is part of the key, it is
prime and does not violate 3NF.
BCNF: The second FD does not have a super key on the left side and thus
violates BCNF.

(b) AB&C stores a customers call history like this: Call(PhoneNumber,
CustomerId, Time, CalledNumber, Duration). A customers phone number and
the time of a call identify a call. At the end of the month, AB&C bills the
customer that owns the phone number from which the call was made.
Remember that a customer may have more than one phone number.


_____________________ (2NF)
1NF: See above
2NF: The key is (PhoneNumber, Time). As every phone line belongs to a
customer, PhoneNumber -> CustomerId is also an FD. As PhoneNumber is a
partial key, this violates 2NF.

(c) Storing multiple values in one column _____________________ (1NF)

This is pretty much the definition for a 1NF violation.

(d) ; , ,
_____________________ (3NF, Key A)
1NF: see above
2NF: The key is only A (so there cannot be any partial keys)
3NF: is a transitive FD to a non-prime attribute (D) which violates
the third NF.
6. What would be a good way to normalize the Call table mentioned above? Remember
that there is a 1:N relationship between customers and phone lines. 1 point

Remove the CustomerId column, as it is not dependent on the full key. We already
have the dependency in the PhoneLine table.

CS122A: Introduction to Data Management

Winter 2015

7. Which of the following is not in the closure of 1 , 2 ,


3 , 4 : - 1 point

(a)
From AC we can get B by applying (1). From ABC we can get D by applying (3)
now we have ABCD. Thus, .
(b)
From AC we can get B by applying (1). From ABC we can get D by applying (3)
now we have ABCD. By applying (2), we can get to ABCDE, so
is in the closure.
(c)
From CD, we can get E by applying (2). From CDE, we can get A by using (4)
and then B by using (1).
(d)
As , this is a trivial FD.
(e)
We cannot apply any of the FDs above, so is not in the closure.

Anda mungkin juga menyukai