16 relationships connect the tables in this schema. Each entry shows the child columns, the parent columns they reference, and the cardinality.
One-to-many
staff.department_id → departments.id
One department can have many staffs (staff.department_id -> departments.id, optional).
One-to-many
beds.room_id → rooms.id
One room can have many beds (beds.room_id -> rooms.id, required).
One-to-many
appointments.patient_id → patients.id
One patient can have many appointments (appointments.patient_id -> patients.id, required).
One-to-many
appointments.doctor_id → staff.id
One staff can have many appointments (appointments.doctor_id -> staff.id, required).
One-to-many
appointments.department_id → departments.id
One department can have many appointments (appointments.department_id -> departments.id, optional).
One-to-many
medical_records.patient_id → patients.id
One patient can have many medical records (medical_records.patient_id -> patients.id, required).
One-to-many
medical_records.doctor_id → staff.id
One staff can have many medical records (medical_records.doctor_id -> staff.id, required).
One-to-many
medical_records.appointment_id → appointments.id
One appointment can have many medical records (medical_records.appointment_id -> appointments.id, optional).
One-to-many
prescriptions.record_id → medical_records.id
One medical record can have many prescriptions (prescriptions.record_id -> medical_records.id, required).
One-to-many
prescriptions.medication_id → medications.id
One medication can have many prescriptions (prescriptions.medication_id -> medications.id, required).
One-to-many
admissions.patient_id → patients.id
One patient can have many admissions (admissions.patient_id -> patients.id, required).
One-to-many
admissions.bed_id → beds.id
One bed can have many admissions (admissions.bed_id -> beds.id, required).
One-to-many
bills.patient_id → patients.id
One patient can have many bills (bills.patient_id -> patients.id, required).
One-to-many
bills.admission_id → admissions.id
One admission can have many bills (bills.admission_id -> admissions.id, optional).
One-to-many
bills.appointment_id → appointments.id
One appointment can have many bills (bills.appointment_id -> appointments.id, optional).
One-to-many
payments.bill_id → bills.id
One bill can have many payments (payments.bill_id -> bills.id, required).