Assignment 2 DM

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

DATA MANAGEMENT

MIT 7033

Assignment 2

By:

AHMAD DAUD BIN AHMAD FAUZI S16100213


KHALIL RAHIME BIN KHAIRI S16100201
AINI ZAHIRAH BINTI MOHD SAH S16100212

12.11
Assume you have been contracted by a university to develop a database system to keep track of
student registration and accommodation records. The university courses are offered by faculties.
Depending on the student’s IQ, there is no limitation to how many courses a student can enrol in.
the faculties are not responsible for student accommodation. The university owns a number of
hostels and each student is given a shared room key after enrolment. Each room has furniture
attached to it.
a. Identify the main entity types for the project.
b. Identify the main relationship types and specify the multiplicity for each relationship. State
any assumptions that you make about the data.
c. Using your answers for (a) and (b), draw a single ER Diagram to represent the data
requirements for the project.

Answers:-

12.13
Create an ER Model for each of the following description:-
a) A large organization has several parking lots, which are used by stuff.
b) Each parking lot has a unique name, location, capacity, and number of floors (where
appropriates).
c) Each parking lot has parking spaces, which are uniquely identified using a space number.
d) Members of staff can request the sole use of a single parking space. Each member of staff
has a unique number, name, telephone extension number, and vehicle license number.
e) Represent all the ER models described in parts (a), (b), (c), and (d) as a single ER model.
Provide any assumptions necessary to support your model.

Answer:-

Staff Uses Space Provides ParkingLot


StaffNo {Pk} 0…1 0…1 SpaceNo {Pk} 1…* 1…1 parkingLotName
Name {Pk}
ExtNo location
vehLicNo capacity
NoFloor

12.14
Create an ER model to represent the data used by the library.
The library provides books to borrowers. Each book is described by title, edition, and year of
publication, and is uniquely identified using the ISBN. Each borrower is described by his or her
name and address and is uniquely identified using a borrower number. The library provides one or
more copies of each book and each copy is uniquely identified using a copy number, status
indicating if the book is available for loan, and the allowable loan period for a given copy. A
borrower may loan one or many books, and the date each book is loaned out and is returned is
recorded. Loan number uniquely identifies each book loan.

Answer:-
Provides
Book Book Copy
1..1 1..*
ISBN {Pk}
CopyNo {Pk}
Title
status
Edition
loanPeriod
yearPublished
1..1
Is
1…*

Borrower Borrows Book Loan


1..1 1…*
borrowerNo {Pk} LoanNo {Pk}
name dateOut
address dateReturned

14.4

Examine the Patient Medication Form for the Wellmeadows Hospital case study (see Appendix B)
shown in Figure 14.18.

a) Identify the functional dependencies represented by the attributes shown in the form in
Figure 14.18. State any assumptions that you make about the data and the attributes shown in
this form.
- patientNo → fullName
- wardNo → wardName
- wardName → wardNo
- drugNo → name, description, dosage, methodOfAdmin
- patientNo, drugNo, startDate → unitsPerDay, finishDate
- The bedNo functional dependencies are unclear. If bedNo was a unique number for the
entire hospital, then could say that bedNo → wardNo. However, bedNO is to do with the
allocation of patients on the waiting list to beds.
b) Describe and illustrate the process of normalizing the attributes shown in Figure 14.18 to
produce a set of well-designed 3NF relations.
- First Normal Form
patientNO, drugNo, startDate, fullName, wardNo, wardName, bedNo, name, description,
dosage, methodOfAdmin, UnitsPerDay, finishDate
- Second Normal Form
patientNo, drugNo, startDate, wardNo, wardName, bedNo, unitsPerDay, finishDate
drugNo, name, description, dosage, methodOfAdmin
patientNo, fullName
- Third Normal Form
patientNo, drugNo, startDate, wardNo, wardName, bedNo, unitsPerDay, finishDate
drugNo, name description, dosage, methodOfAdmin
patientNo, fullName
wardNo, wardName
c) Identify the primary, alternate, and foreign keys in your 3NF relations.
patientNo (FK), drugNo (FK), startDate, wardNo(FK), wardName, bedNo, unitsPerDay, finishDate
drugNo, name description, dosage, methodOfAdmin
patientNo, fullName
wardNo, wardName (AK)
(Primary key is the underlined which are patientNo, drugNo, startDate, wardNo)

14.5

The table shown in Figure 14.19 lists sample dentist/patient appointment data. A patient is given and
appointment at a specific time and date with a dentist located at a particular surgery. On each day of
patient appointments, a dentist is allocated to a specific surgery for that day.

a) The table shown in Figure 14.19 is susceptible to update anomalies. Provide examples of
insertion, deletion, and update anomalies.
- Insertion anomalies = the details about dentists (staffNo / dentistName) and patients
(patientNo / patientNames) are repeated in the relation, so each insertion must guarantee
that these details are consistent.
- Insertion anomalies with null values = if want to insert a doctor into the practice, then have
to insert null values for patient information
- Update anomalies = if want to modify the name of dentist or a patient, must ensure to find
and modify all occurrences of those names in the relation.
- Deletion anomalies = if delete all the patient’s appointment, then lose all the information
about the patient. If delete all of the doctor’s appointment, the loss of all information about
the doctor.
b) Identify the functional dependencies represented by the attributes shown in the table of
Figure 14.19. State any assumptions you make about the data and the attributes shown in this
table.
Attributes: staffNo, appointmentDate, appointmentTime, patNo
staffNo → dentistName
appointmentDate → appointmentTime
appointmentTime → appointmentDate
patNo →patName

c) Describe and illustrate the process of normalizing the table shown in Figure 14.19 to 3NF
relations. Identify the primary, alternate and foreign keys in your 3NF relations.
1NF
Appointment (staffNo, appointmentDate, appointmentTime, dentistName, patNo, patName,
surgeryNo)

2NF
Appointment (staffNo, appointmentDate, appointmentTime, patNo, patName)
SurgeryReg (staffNo, appointmentDate, surgeryNo
Dentist (staffNo, dentistName)

3NF
Appointment (staffNo, appointmentDate, appointmentTime, patNo)
SurgeryReg (staffNo, appointmentDate, surgeryNo)
Dentist (staffNo, dentistName)

Appointment – staffNo (PK), appointmentDate (PK), appointmentTime (PK), patNo (FK)


SurgeryReg – staffNo (PK), appointmentDate (PK), surgeryNo
Dentist – staffNo (PK)
Patient – patNo (PK)

You might also like