Presentation is loading. Please wait.

Presentation is loading. Please wait.

CMPE Database Systems Exercise #3 Solutions

Similar presentations


Presentation on theme: "CMPE Database Systems Exercise #3 Solutions"— Presentation transcript:

1 CMPE 180-38 Database Systems Exercise #3 Solutions
Department of Computer Engineering San Jose State University Spring 2017 Instructor: Ron Mak

2 Unofficial Field Trip Computer History Museum in Mt. View
Provide your own transportation to the museum. Saturday, May 20, 11:30 – closing time Special free admission (for my students only). Experience a fully restored IBM 1401 mainframe computer from the early 1960s in operation. Do a self-guided tour of the Revolution exhibit. New Make/Software: Change the World exhibit.

3 1.a. and 1.b. Describe an insertion anomaly with the table.
MovieCode MovieName ActorId ActorName AssistantId AssistantName ActorPay M100 Le Film Noir A11 Jean Wayne AA01 Julia $2,200,000 A22 G. Autré $1,500,000 A33 C. Westwood AA02 Rob $2,000,000 A44 Barbara Stan $2,500,000 M200 Horse Opera AA03 Leslie $1,900,000 $2,100,000 A55 R.W. Raygun $1,200,000 Describe an insertion anomaly with the table. You cannot add an actor or an assistant into the table without adding a movie. Describe a deletion anomaly with the table. If Jean Wayne decides not to star in Horse Opera and therefore the fifth row of the table is deleted, we lose the id and name of assistant Leslie.

4 1.c. Describe a modification anomaly with the table.
MovieCode MovieName ActorId ActorName AssistantId AssistantName ActorPay M100 Le Film Noir A11 Jean Wayne AA01 Julia $2,200,000 A22 G. Autré $1,500,000 A33 C. Westwood AA02 Rob $2,000,000 A44 Barbara Stan $2,500,000 M200 Horse Opera AA03 Leslie $1,900,000 $2,100,000 A55 R.W. Raygun $1,200,000 Describe a modification anomaly with the table. If assistant Julia retires and is replaced by another person, three rows of the table need to be modified. Also, three rows need to be modified if assistant Rob retires.

5 1.d. MovieCode MovieName ActorId ActorName AssistantId AssistantName ActorPay M100 Le Film Noir A11 Jean Wayne AA01 Julia $2,200,000 A22 G. Autré $1,500,000 A33 C. Westwood AA02 Rob $2,000,000 A44 Barbara Stan $2,500,000 M200 Horse Opera AA03 Leslie $1,900,000 $2,100,000 A55 R.W. Raygun $1,200,000 Draw a diagram showing full key, partial, and transitive functional dependencies of the table. Clearly label the type of functional dependency.

6 1.e. What is the result of normalizing the table to 3NF?

7 2.a. Year Department Leader ID Amount 2015 CMPE Sigurd Meldal $12,000 CS Sami Khuri $11,000 2016 Math Bem Cayco $10,000 Xiao Su You want to record the fact that in the year 2017, Mary Jane, who has ID and does not belong to a department, is the leader of the Spartan Committee. Briefly explain why you can or cannot add a 2017 row for her and enter nulls for the Department and Amount fields. You cannot add a 2017 row where the Department field is null. The Department field is part of the composite primary key. Therefore, leaving that field null violates the entity integrity constraint.

8 2.b. Normalize this table to third normal form (3NF).
Year Department Leader ID Amount 2015 CMPE Sigurd Meldal $12,000 CS Sami Khuri $11,000 2016 Math Bem Cayco $10,000 Xiao Su Normalize this table to third normal form (3NF). ID  Leader is a transitive functional dependency. We can move those columns into a new table: Year Department ID Amount ID Leader

9 2.c. Year Department Leader ID Amount 2015 CMPE Sigurd Meldal $12,000 CS Sami Khuri $11,000 2016 Math Bem Cayco $10,000 Xiao Su Give a good reason why you may want to leave this table unnormalized. The original table has faster query response.

10 3.a. Show the full key functional dependencies, any partial functional dependencies, and any transitive functional dependencies.

11 3.b. Normalize the table to third normal form (3NF).


Download ppt "CMPE Database Systems Exercise #3 Solutions"

Similar presentations


Ads by Google