I'm trying to produce a Dr-patient appointment system. So far I have four tables:-
Patient:- |
Doctor:- |
Appointment:- |
Availability:- |
patientID |
doctorName |
time |
time |
name |
room |
date |
doctorName |
address |
|
patientID |
|
|
|
doctorName |
|
All relationships are 1 to manys, with the many side coming out of the appointment table.
Patient:- The table for patient details
Doctor:- The table for doctor detailsAppointment:- the table for appointments.
Availability:- The table which stores timeslots each doctor is available
However this is all relatively new stuff to me and I'm getting quite thrown. Firstly in the doctors table should I have a field for DoctorID and use that as a primary key instead of the doctors name? Even though there's only likely to ever be a handful of records in that table.Secondly if I was to change to DoctorID in all tables instead of the doctorName would I still easily able to access the doctorsName if and when required? This part is what confuses me, maybe I'm just over thinking these things.The reason I ask is for example say I was to produce a report of an appointment which showed the doctorID, I should be able to get the doctors name for the report based on the relationship right? Likewise for the patient based on patient ID.I'm guessing I also have enough information in the tables to check against and prevent appointment clashes.Many thanks,