Assignment - 3 2021 Ten Have
Assignment - 3 2021 Ten Have
4.1 (5 points)
Let S = {red, yellow, green} and T = {plaid, stripe,
dot}. Find the Cartesian product of S and T.
Assumptions:
1. Assume that author can have multiple values. Therefore, isbn in BOOK is not necessarily
unique. The first 2 records in the instance above are examples of this.
2. The goal of this exercise is to find a primary key that uniquely identifies records (tuples) in
the Book schema (it’s not necessarily a commonsense key for identifying unique books).
3. Assume author values are always spelled correctly and consistently: e.g., Last First Middle.
4. Different editions (of the same title/author/publisher) always have different isbn numbers
and different publishing dates.
4.3b Given the above assumptions, I can propose some example keys:
superkey: title, author, isbn, publisher, pubDate
candidate keys: author, isbn or title, author, publisher, pubDate
primary key: author, isbn
NOTE:
From the text and lecture, I know that the correct way to handle a multiple-valued attribute
(like author) is to move it into a weak entity, with isbn as a key in both tables. But for this
exercise, I wanted to experiment with would happen if you don’t make a 2nd table for the
multi-valued author attribute.
4.6 (10 points) Relational DB schema for Customer Order E-R diagram Fig 4.9
NOTE: this answer assumes that qualified attribute names are sufficient for distinguishing
the identical non-qualified attributes names from eachother;
e.g., Customer.number ^= Order.number.
Customer (custID, creditLimit, lastName, firstName, street, city, state, zip, areaCode,
number)
Order (orderNo, custId, date, totalAmount, tax, street, city, state, zip, areaCode, number)
4.12 (15 points) Relational DB schema for Physical Therapy Center described in given figure:
Patient 1 has M Prescription M from 1 Physician
1
1
covers
scheduled
M
M
Visit
M
treats 1
Therapist
Appointment
1
includes
used
1
1
Equipment
Treatment
4.12 Answer
Patient (patientID, patientLastName, patientFirstName, patienttDOB, …)
4.15 (20 points) Design a relational database schema for the data described in Exercise 3.11,
including the specialization of dentists:
NOTE: “Person” generalization is not represented (Method 2).
Person
U
U
Patient Professional
(0,M
o
)
Charge
U
U
Makes
(1,1
)
Dentist Hygienist
)
incurs
,M
1,1
(0
(0
conducts U U
,M
)
)
,1
(1
)
, M
(0
M)
1,1
o
(0,
(0,M)
includes performs
U
U
Payment assists
1,1
Initial Surgical (1,1)
(1
,1
)
) M
(0,
Procedure/
(1,1)
Service
shows
(0,M ( 1 ,1
) )
works
Work
uses
Needed
(0,M)