Docsity

Database Design: Doctor, Patient, and Appointment Relations, Assignments of Statistics

Toggle sidebar
bg1
Programming)Assignment)Unit)1)–!Solution("
Doctor&Relation&
DoctorID'
Number'
This'uniquely'identifies'Doctor'relation.'
Null'constraint,'Entity'integrity'constraint,'Unique'constraint:'
This'is'the'primary'key'of'Doctor'relation.'
Name'
Text'
Null'constraint:'Every'doctor'has'a'name.'
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.'''
Phone'
Number'
Null'constraint:'Every'doctor'has'a'phone'number.'
Semantic'integrity'constraint:'The'phone'number'has'a'
specific'format'that'should'be'validated'('This'is'not'
required'in'your'peers'assignment)'
SpecialtyNumber'
Number'
Null'constraint:'Every'doctor'has'a'specialty.'This'is'an'
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&
pf3

Partial preview of the text

Download Database Design: Doctor, Patient, and Appointment Relations and more Assignments Statistics in PDF only on Docsity!

Programming Assignment Unit 1 – Solution

Doctor Relation DoctorID Number This uniquely identifies Doctor relation. Null constraint, Entity integrity constraint, Unique constraint: This is the primary key of Doctor relation. Name Text Null constraint: Every doctor has a name. 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. Phone Number Null constraint: Every doctor has a phone number. Semantic integrity constraint: The phone number has a specific format that should be validated ( This is not required in your peers assignment) SpecialtyNumber Number Null constraint: Every doctor has a specialty. This is an 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

PatientID Number This uniquely identifies Patient relation. Null constraint, Entity integrity constraint, Unique constraint: This is the primary key of Patient relation. Name Text Null constraint: Every patient has a name. 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. Phone Number Null constraint: Every patient has a phone number. Semantic integrity constraint: The phone number has a specific format that should be validated (This is not required in your peers’ assignment). Email Text It is possible that patient doesn’t have an e-mail address. 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. AddedDate Date Null constraint: This is the registration date of patient to hospital. Every patient should have a registration 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. DoctorID Number Null constraint: Each patient is admitted by one doctor 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