0% found this document useful (0 votes)
63 views

Programming Assignment Unit 1 Solution

The document describes the schema for three database relations: Doctor, Patient, and Appointment. The Doctor relation contains attributes for a doctor's ID, name, phone number, specialty number, and specialty. The Patient relation contains attributes for a patient's ID, name, phone number, email, address, registration date, allergies, and doctor ID. The Appointment relation contains attributes for an appointment's ID, doctor ID, patient ID, date, blood pressure, weight, treatment notes, and medicines. Primary keys and foreign keys are defined for each relation, along with other constraints.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Programming Assignment Unit 1 Solution

The document describes the schema for three database relations: Doctor, Patient, and Appointment. The Doctor relation contains attributes for a doctor's ID, name, phone number, specialty number, and specialty. The Patient relation contains attributes for a patient's ID, name, phone number, email, address, registration date, allergies, and doctor ID. The Appointment relation contains attributes for an appointment's ID, doctor ID, patient ID, date, blood pressure, weight, treatment notes, and medicines. Primary keys and foreign keys are defined for each relation, along with other constraints.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Programming

Assignment Unit 1 – Solution


Doctor Relation

This uniquely identifies Doctor relation.


DoctorID Number Null constraint, Entity integrity constraint, Unique constraint:
This is the primary key of Doctor relation.
Null constraint: Every doctor has a name.

Name Text Note that Name refers to name and surname of the doctor.
This is a design choice. Alternatively, there can be two
attributes as Name and Surname.
Null constraint: Every doctor has a phone number.

Phone Number Semantic integrity constraint: The phone number has a


specific format that should be validated ( This is not
required in your peers assignment)
Null constraint: Every doctor has a specialty. This is an
SpecialtyNumber Number
identifier for the specialty.
Specialty Text Null constraint: This describes the specialty of a doctor.

Primary key : DoctorID


Candidate keys : Name, Phone
Name, Phone, SpecialtyNumber
Degree of relation : 5

Patient Relation
This uniquely identifies Patient relation.
PatientID Number Null constraint, Entity integrity constraint, Unique constraint:
This is the primary key of Patient relation.
Null constraint: Every patient has a name.

Name Text Note that Name refers to name and surname of the patient.
This is a design choice. Alternatively, there can be two
attributes as Name and Surname.
Null constraint: Every patient has a phone number.
Phone Number Semantic integrity constraint: The phone number has a
specific format that should be validated (This is not required
in your peers’ assignment).
It is possible that patient doesn’t have an e-mail address.
Email Text Semantic integrity constraint: E-mail has a specific format
that should be validated (This is not required in your peers’
assignment).
Address Text Null constraint: Every patient has an address.
Null constraint: This is the registration date of patient to
hospital. Every patient should have a registration date.
AddedDate Date
Semantic integrity constraint: Date has a specific format that
should be validated (This is not required in your peers’
assignment).
Allergies Text Patient may not have any allergies.
Null constraint: Each patient is admitted by one doctor
DoctorID Number Referential integrity constraint: DoctorID is a foreign key to
the Doctor relation.

Primary key : PatientID

Candidate keys : Name, Phone


Name, Address
Degree of relation : 8

Appointment Relation
This uniquely identifies Appointment relation.
AppointmentID Number Null constraint, Entity integrity constraint, Unique constraint:
This is the primary key of Appointment relation.
Null constraint: There should be a doctor for each
appointment.
DoctorID Number
Referential integrity constraint: DoctorID is a foreign key to
the Doctor relation.
Null constraint: There should be a patient for each
appointment.
PatientID Number
Referential integrity constraint: PatientID is a foreign key to
the Patient relation.
Null constraint: This is the registration date of patient to
hospital. Every patient should have a registration date.
AppointmentDate Date Semantic integrity constraint: Date has a specific format that
should be validated (This is not required in your peers’
assignment).
BloodPressure Number Null constraint: During each appointment, blood pressure of
the patient is stored.
Weight Number Null constraint: During each appointment, weight of the
patient is stored.
TreatmentNotes Text Null constraint: During each appointment, doctor writes
about treatment of patient.
Medicines Text During appointment doctor may or may not prescribe
medicine/s

Primary key : AppointmentID

Candidate key : DoctorID, PatientID, AppointmentDate

Degree of relation : 8

You might also like