Homework2

advertisement
COMS 340
Spring 2002
Hart
Homework II
The following homework assignment is designed to help you prepare for Friday’s exam.
Hence, I am changing the due date from Friday to Thursday. While this gives you less
time to complete the assignment, it will give us a chance on Thursday to discuss the
answers and will thus be more valuable than if we don’t discuss it until after the exam.
1. Armstrong’s axioms allow one to infer (further) functional dependencies from a
given set of functional dependencies. The following rules (listed on p. 385) can
be proven from the original three axioms (on p. 384). Supply the proofs for each
of them.
a.
b.
c.
d.
Self-determination: A  A
Decomposition: If A  B,C, then A  B and A  C
Union: If A  B and C  D, then A,C  B,D
Composition: If A  B and C  D, then A,C  B,D
2. Consider the following relation schema:
Employee_ID Course_Title Name Dept_Name Salary Date_Completed
This is an example of a relation that is not in 2d normal form. Decompose this
relation so that it is in 2d normal form. Be sure to note any foreign key references in
your decomposition.
3. The following table represents a shipping relation (table) for the Wacky Widgets
Company:
SHIPMENT
Shipment_Num
409
618
723
824
629
Origin
Seattle
Chicago
Boston
Denver
Minneapolis
Destination
Denver
Dallas
Atlanta
Los Angeles
St. Louis
Distance
1,537
1,058
1,214
1,150
587
Since the table contains a non-composite primary key, it is automatically in secondnormal form. Determine whether this table contains a third-normal form violation. If
it does, decompose the table into two (or more) tables that are free of third-normal
form violations. Be sure to note any foreign key references in your decomposition.
4. For each of the following relations, indicate the normal form for that relation. If
the relation is not in third normal form, decompose it into third normal form
relations. Be sure to note any foreign key references in your decomposition.
Functional dependencies (other than those implied by the primary key) are shown
where appropriate.
a. CLASS
Course_No Section_No
b. CLASS
Course_No Section_No Room
c.
Course_No Section_No Room Capacity
Room  Capacity
d.
Course_No Section_No Course_Name Room Capacity
Course_No  Course_Name
Room  Capacity
5. Give a precise but concise explanation of each of the following. Give an
examples, complete with data, of tables that are susceptible to each:
a. Insertion anomaly
b. Modification anomaly
c. Deletion anomaly
Download