



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




2.32 Examine the data in the Veterinary Office List—Version One in Figure 1-30 (see page 52), and state assumptions about functional dependencies in that table. What is the danger of making such conclusions on the basis of sample data? PetName (PetType, PetBreed, PetDOB, OwnerLastName, OwnerFirstName, OwnerPhone, OwnerEmail) OwnerEmail (OwnerLastName, OwnerFirstName, OwnerPhone)
OwnerPhone (OwnerLastName, OwnerFirstName, OwnerEmail) The danger is that there may be possibilities not apparent from sample data. For example, two owners might have pets with the same name.
2.33 Using the assumptions you stated in your answer to question 2.32, what are the determinants of this relation? What attribute(s) can be the primary key of this relation? Attributes that can be the primary key are called candidate keys.
Determinants: PetName, OwnerEmail, OwnerPhone Candidate keys: PetName
2.34 Describe a modification problem that occurs when changing data in the relation in question 2.32 and a second modification problem that occurs when deleting data in this relation.
Changes to owner data may need to be made in several rows.
Deleting data for the last pet of an owner deletes owner data as well.
2.38 Apply the normalization process to the Veterinary Office List—Version One relation shown in Figure 1-30 (see page 55) to develop a set of normalized relations. Show the results of each of the steps in the normalization process.
STEP ONE: PET-AND-OWNER (PetName, PetType, PetBreed, PetDOB, OwnerLastName, OwnerFirstName, OwnerPhone, OwnerEmail)
Functional Dependencies: PetName (PetType, PetBreed, PetDOB, OwnerLastName, OwnerFirstName, OwnerPhone, OwnerEmail) OwnerEmail (OwnerLastName, OwnerFirstName, OwnerPhone)
OwnerPhone (OwnerLastName, OwnerFirstName, OwnerEmail) PET-AND-OWNER Candidate Keys: PetName
Is every determinant a candidate key?
NO — OwnerEmail and OwnerPhone are NOT candidate keys.
STEP TWO:
Break into two relations: OWNER and PET
OWNER (OwnerLastName, OwnerFirstName, OwnerPhone, OwnerEmail) PET (PetName, PetType, PetBreed, PetDOB, {Foreign Key})
FOR OWNER:
Functional Dependencies:
OwnerEmail (OwnerLastName, OwnerFirstName, OwnerPhone) OwnerPhone (OwnerLastName, OwnerFirstName, OwnerEmail)
OWNER Candidate Keys: OwnerPhone, OwnerEmail
Is every determinant a candidate key?
YES — OwnerEmail and OwnerPhone are candidate keys — Normalization complete!
We can choose either candidate key as primary key.
(A) IF WE USE OwnerPhone as primary key, THEN:
OWNER (OwnerPhone, OwnerLastName, OwnerFirstName, OwnerEmail) PET (PetName, PetType, PetBreed, PetDOB, OwnerPhone )
Functional Dependencies:
PetName (PetType, PetBreed, PetDOB, OwnerPhone)
PET Candidate Keys: PetName
Is every determinant a candidate key?
YES — PetName is a candidate key — Normalization complete!
FINAL NORMALIZED REALTIONS:
OWNER (OwnerPhone, OwnerLastName, OwnerFirstName, OwnerEmail)
PET (PetName, PetType, PetBreed, PetDOB, OwnerPhone )
(B) IF WE USE OwnerEmail as primary key, THEN:
OWNER (OwnerPhone, OwnerLastName, OwnerFirstName, OwnerEmail)
PET (PetName, PetType, PetBreed, PetDOB, OwnerEmail )
Functional Dependencies:
PetName (PetType, PetBreed, PetDOB, OwnerEmail)
PET Candidate Keys: PetName
Is every determinant a candidate key?
STUDENT-SIBLING ( StudentNumber , SiblingName)
FOR STUDENT-SIBLING: Functional Dependencies:
(StudentNumber, SiblingName) (StudentNumber) (StudentNumber, SiblingName) (SiblingName) STUDENT-SIBLING Candidate Keys: (StudentNumber, SiblingName)
Is every determinant a candidate key? YES — (StudentNum, SiblingName) is a candidate key — Normalization complete!
FOR STUDENT: STUDENT (StudentNumber, StudentName, Major)
Functional Dependencies: StudentNumber (StudentName, Major)
STUDENT Candidate Keys: StudentNumber
Is every determinant a candidate key? YES — StudentNumber is a candidate key — Normalization complete!
FINAL NORMALIZED REALTIONs: STUDENT (StudentNumber, StudentName, Major)
STUDENT-SIBLING ( StudentNumber , SiblingName)
ORDER_ITEM (OrderNumber, SKU, Quantity, Price)
Where SKU is a “Stocking Keeping Unit” number, which is similar to a part number. Here it indicates which product was sold on each line of the table. Note that one OrderNumber must have at least one SKU associated with it, and may have several. Use this table and the detailed discussion of normal forms of pages 88-89 to answer the following questions.
First Normal Form is any table that meets the definition of a relation (Figure 2.1 below). ORDER_ITEM is in 1NF.
Second Normal Form is any table that 1) in First Normal Form, and 2) all nonkey attributes are determined by the entire primary key. In this case, the Primary Key is OrderNumber, SKU. Because SKU alone determines Price (SKU → Price), ORDER_ITEM is NOT in 2NF.
This is solved by creating another table (PRODUCT), where SKU is both the Primary Key and Foreign Key in PRODUCT, and Price is moved out of ORDER_ITEM and into the PRODUCT Table.
ORDER_ITEM (OrderNumber, SKU, Quantity) PRODUCT (SKU, Price)
Third Normal Form is any table that 1) in Second Normal Form, and 2) and no nonkey attributes are determined by any other nonkey attributes. Because the original question was not in Second Normal Form, it was NOT in Third Normal Form. The solution in B fixes this problem, and then both ORDER_ITEM and PRODUCT are in Third Normal Form.