0-315 Intersession 2007 ASSIGNMENT # 2

advertisement
60-315 ASSIGNMENT # 2(ER to Relational Mapping, Normalization)
Handed Out: May 25th
Due : June 1st
Total: 45 marks(5+10+10+10+10) + 10 bonus(for question 6)
1. The following tables form part of a database held in a relational DBMS.
Hotel
Room
Booking
Guest
(hotelNo, name, address)
(roomNo, hotelNo, type, price)
(hotelNo, guestNo, dateFrom, dateTo, roomNo)
(guestNo, name, address)
where
Hotel contains hotel details and hotelNo is the primary key.
Room contains room details for each hotel and roomNo, hotelNo forms the primary
key.
Booking contains details of the bookings and the primary key comprises hHotelNo,
guestNo and dateFrom.
Guest contains guest details and guestNo is the primary key.
Draw an ER model for the above relational model
2. The table shown below displays the details of the roles played by actors/actresses in films.
filmNo
fTitle
F1100
Happy Days
F1109
Snake Bite
dirNo
D101
D101
D101
D076
D076
director
actorNo
aName
role
timeOnScreen
Jim Alan
Jim Alan
Jim Alan
Sue Ramsay
Sue Ramsay
A1020
A1222
A1020
A1567
A1222
Sheila Toner
Peter Watt
Sheila Toner
Steven McDonald
Peter Watt
Jean Simson
Tom Kinder
Silvi Simpson
Tim Rosey
Archie Bold
15.45
25.38
22.56
19.56
10.44
(a) Describe why the table shown below is not in first normal form (1NF).
(b) The table shown above is susceptible to update anomalies. Provide examples of
how insertion, deletion, and modification anomalies could occur on this table.
(c) Identify the functional dependencies represented by the table shown above.
(d) Using the functional dependencies identified in part (c), describe and illustrate
the process of normalization by converting the table shown in the Figure above to 3NF
3.a. Using the following INVOICE table structure, draw its functional dependency
diagram that includes all functional dependencies (including all partial and transitive
dependencies). You can assume that the table does not contain repeating groups and
that any invoice number may reference more than one product. (This table uses a
composite primary key – (INV_NUM,PROD_NUM) ). You can assume that any
given product is supplied by a single vendor, but a vendor can supply many products.
Attribute name
Sample value
INV_NUM
PROD_NUM
SALE_DATE
PROD_DESCRIPTION
VEND_CODE
VEND_NAME
NUMBER_SOLD
PROD_PRICE
211347
AA_E3422QW
06/25/1999
B&D Rotary sander, 6 in. disk
211
NeverFail, Inc.
2
$49.95
b. Using the initial functional dependency diagram drawn in problem 3a, remove all
partial dependencies(non-full FDs), draw the new dependency diagrams, and identify
the normal forms for each table structure you created.
c. Using the table structures you have created in problem 3b, remove all transitive
dependencies, draw the new dependency diagrams, and identify the normal forms for
each table structure you created.
4. Suppose that you have been given the following table. The data reflect that a professor
can have multiple advisees, can serve on multiple committees, and can edit more than one
journal.
PROF_NUMBER
903
903
903
904
904
ADVISEE_NUMBER
1235
1342
1432
2143
1277
COMMITTEE_CODE
PROMO
TRAFFIC
APPEALS
TRAFFIC
DEVELOPMENT
JOURNAL_CODE
JMIS
JQED
MGTP
REWY
JTU
Given this information,
a. Identify the multivalued dependencies.
b. Eliminate the multivalued dependencies by converting the table to 4NF.
5. Examine the Patient Medication Form for the Wellmeadows Hospital case study
shown in the Figure below.
Describe and illustrate the process of normalizing the data shown in the above Figure
to first (1NF), second (2NF), third (3NF), and BCNF. Assume that each patient can be
uniquely identified by his or her ( Patient No, Drug No and Start Date) => Primary
key is ( Patient No, Drug No and Start Date). Also, assume that the following FDs
have been identified.
Patient No -> Full Name
Ward No -> Ward Name
Drug No -> Name, Description, Dosage, Method of Admin
Patient No, Drug No, Start Date -> Units per Day, Finish date
(Bonus Question) 6. a. Given the following relation and information, normalize the
relation EMPLOYEE to 3NF and BCNF.
EMPLOYEE ( Name, Project, Task, Office, Floor, Phone )
Note: Keys are underlined.
Name
Bill
Bill
Bill
Bill
Sue
Sue
Sue
Ed
Project
100X
100X
200Y
200Y
100X
200Y
300Z
100X
Task
T1
T2
T1
T2
T33
T33
T33
T2
Office
400
400
400
400
442
442
442
588
Floor
4
4
4
4
4
4
4
5
Phone
1400
1400
1400
1400
1442
1442
1442
1588
-
Name is the employee's name
-
Project is the project they are working on. Bill is working on two different projects,
Sue is working on 3.
-
Task is the current task being worked on. Bill is now working on Tasks T1 and T2.
Note that Tasks are independent of the project. Examples of a task might be faxing a
memo or holding a meeting.
-
Office is the office number for the employee. Bill works in office number 400.
-
Floor is the floor on which the office is located.
-
Phone is the phone extension . Note this is associated with the phone in the given
office.
b. Given the above relation and information, normalize the relation EMPLOYEE to
BCNF and 4NF.
Download