Back to the Data Model
The Requirement is a Database for Hospitals and Patients.
The problem has been described by Noor as follows :-
Noor said�
I have that table : (Hospital) which has a primary key : hospitalID
i need to make at least 3 FK of that PK(HospitalID).
Barry asks Why ?
The first Step is to design the Data Model correctly, and then everything else will fall into place.
Noor - Please write in English what you are trying to do.
When i came to make the third relationship i face that error and i dont know how to solve it.
The problem is "Unable to create relationship 'FK_Staff_Hospital'. Introducing FOREIGN KEY
constraint 'FK_Staff_Hospital' on table 'Staff' may cause cycles or multiple cascade paths.
Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY
constraints.Could not create constraint. See previous errors"".
if any one can explain to me what that mean or how to solve it please help me.
>>>>>> i know that if i change the insert and update rule the error will disappear
but i dont want that it will affect to my database.
i use database diagram in mysql(microsoft sql server Management studio Express)>
this error killing me and i dont know how to continue help me.
Subject: hospital data base
Question: Consider a hospital:
� Patients are treated in a single ward by the doctors assigned to them.
� Usually each patient will be assigned a single doctor, but in rare cases they will have two.
� Healthcare assistants also attend to the patients, a number of these are associated with each ward.
� Initially the system will be concerned solely with drug treatment.
� Each patient is required to take a variety of drugs a certain number of times per day and for varying
lengths of time.
� The system must record details concerning patient treatment and staff payment.
� Some staff are paid part time and doctors and care assistants work varying amounts of overtime at
varying rates (subject to grade).
� The system will also need to track what treatments are required for which patients and when and it
should be capable of calculating the cost of treatment per week for each patient (though it is currently
unclear to what use this information will be put).
� Is this a good project and how many times do i need to do it and can you give me any sample project like that project ?
Barry says the Things of Interest are :-
� Doctors
� Drugs
� Drugs Treatments
� Healthcare Assistants
� Patients
� Patient Treatments
� Wards
C. How are they related ?
C.1 A Doctor can be assigned to many Patients.
C.2 To be determined.
Barry Williams
September 1st. 2009
Principal Consultant
Database Answers