MichaelHutton
Registered User.
- Local time
- Today, 02:17
- Joined
- Apr 12, 2015
- Messages
- 11
Hi all,
I'm a relative newbie at database design and I just can't seem to get my head around how I should go about designing a database efficiently. I don't want to make any design 'clangers'. I am trying to design a custom database for us to collect audit information for our medical group. I realise I might be reinventing the wheel but maybe if I can just re-align it instead....
My main tables are:
1. tPatients - NHSNumber (primary key), names etc.....
2. tAdmissions - AdmissionID (PK), fkNHSNumber, dates, diagnosis etc
3. tProcedures - ProcedureID (PK), fkAdmissionID, dates and details etc
I have made a one to many relationship for the tPatients to tAdmissions using the NHSNumber to fkNHSNumber and then another one to many relationship from the tAdmissions to the tProcedures using the AdmissionID to fkAdmissionID. As I understand it that seems to be the way I should do it being that each patient can have multiple admissions and procedures are associated with an admission. It seems fine (I think).
My issue comes when I want to add a complication table, tComplications, but I want a complication to be associated with either an admission or a procedure (the patient might not have had a procedure) but I just can't get my head around how I should design it. This is where I get a bit stuck and although I've read a bit my head is swirling. I just want to get it right the first time and not break any rules so to speak.
tComplications has two foreign keys to each table? What sort of relationship should I enforce? Can one table reference two different tables? Should I just use a query? Should I have three cascading tables?
You can see me going round in circles. If anyone understands what I am trying to get at I would be most grateful if they could stop me spinning and head me off in the right direction..... :banghead:
Michael
I'm a relative newbie at database design and I just can't seem to get my head around how I should go about designing a database efficiently. I don't want to make any design 'clangers'. I am trying to design a custom database for us to collect audit information for our medical group. I realise I might be reinventing the wheel but maybe if I can just re-align it instead....
My main tables are:
1. tPatients - NHSNumber (primary key), names etc.....
2. tAdmissions - AdmissionID (PK), fkNHSNumber, dates, diagnosis etc
3. tProcedures - ProcedureID (PK), fkAdmissionID, dates and details etc
I have made a one to many relationship for the tPatients to tAdmissions using the NHSNumber to fkNHSNumber and then another one to many relationship from the tAdmissions to the tProcedures using the AdmissionID to fkAdmissionID. As I understand it that seems to be the way I should do it being that each patient can have multiple admissions and procedures are associated with an admission. It seems fine (I think).
My issue comes when I want to add a complication table, tComplications, but I want a complication to be associated with either an admission or a procedure (the patient might not have had a procedure) but I just can't get my head around how I should design it. This is where I get a bit stuck and although I've read a bit my head is swirling. I just want to get it right the first time and not break any rules so to speak.
tComplications has two foreign keys to each table? What sort of relationship should I enforce? Can one table reference two different tables? Should I just use a query? Should I have three cascading tables?
You can see me going round in circles. If anyone understands what I am trying to get at I would be most grateful if they could stop me spinning and head me off in the right direction..... :banghead:
Michael