Assignment1 DDL and DML (As-Level)
Assignment1 DDL and DML (As-Level)
Q2) A hospital has a number of doctors and a number of wards. A ward has a number of patients. A patient may be
treated by more than one doctor and a doctor treats many patients.
Data is to be recorded in a relational database and the tables include DOCTOR and PATIENT.
(a) (i) What is the relationship between DOCTOR and PATIENT? (1)
(ii) Show this relationship with an entity-relationship (E-R) diagram. (1)
(iii) Draw an E-R diagram showing a database design which can be produced so that the doctor and patient
data are fully normalised.
Explain how the relationships are implemented. (4)
(b) (i) What is the relationship between WARD and PATIENT? (1)
(ii) Show this relationship with an E-R diagram. (1)
(c) Two of the incomplete table designs are:
PATIENT(PatientID, PatientName, Address, NextOfKin)
WARD(WardName, NurseInCharge, NumberOfBeds, NumberOfOccupiedBeds, Specialism)
Explain how the relationship between PATIENT and WARD is implemented. (2)
(d) The following Data Manipulation Language query is run.
SELECT WardName
FROM WARD
WHERE NumberOfOccupiedBeds < NumberOfBeds
What useful information is produced for the Hospital Administrator? (2)
Page 1 of 4
Computer Science Assignment
1.8: Database and Data Modelling
The company has a number of depots in different towns. Each town has one depot only. A number of vehicles are
available for hire. Each vehicle is based at one of the depots. Every vehicle starts and ends a hire from its base depot.
Depot data consist of:
Depot address
A vehicle type code. Vehicles are coded as SC Small Car, LC Large Car or V Van.
Vehicle mileage
Unique Customer ID
Customer address
Customer ID
Return date
Driving licence check. A check is carried out to confirm that customers have a valid driving licence and this is
recorded. This check is done when the customer shows their driving licence when they collect the vehicle.
Hire charge
Page 2 of 4
Computer Science Assignment
1.8: Database and Data Modelling
Page 3 of 4
Computer Science Assignment
1.8: Database and Data Modelling
Page 4 of 4