help...

Associate
Joined
29 Jun 2006
Posts
2,458
Location
Manchester
I'm doing my a2 computing project and bit stuck, I'm making a program in Delphi that basically books appointments for patients. and i need to work out whats gonna link together and what primary keys and foreign keys are what. its meant to be normalised :(

I've got the patient file, with patient id as primary key, then all their relevant data like surname address etc is stored in this file, simple enough.

I've got the consultant file, with consultant id as primary key, then all of their relevant data, same as patient file, just storing records.

next ill have a clinic file, which will store the date, time, place and consultant id, so it will basically be a list of each consultants clinics that can be booked to. not sure what i will use as the primary key here though :confused::confused: what should i use?

then the main 'link table' file which is where the appointments will be stored, now i need to store the patient id and the clinic primary key, but do i need to store anything else in this file?

so basically its like this...


[Patient File] --> [Appointments File] <--- [Clinics File] <--- [Consultants File]

but im just not sure what primary keys/foreign keys should be used and how they'd link each table. anyone any ideas?
 
[Patient File] --> [Appointments File] <--- [Clinics File] <--- [Consultants File]

If patient, appointment, clinic and consultant are your "entities" then each one needs a primary key. You've already got keys defined for patient and consultant I think, so you just need an appointment id and a clinic id. Just make these auto-incrementing integers for now. The appointment link table will then contain an three columns: appointment id, patient id and clinic id.
 
Back
Top Bottom