CREATE TABLE if not exists PatientDetails
(pt_id varchar(15) not null,
pt_name varchar(20) not null,
pt_sname varchar(20) not null,
pt_age numeric,
primary key(pt_id));
create table if not exists who_staging.Symptom (
sypt_id varchar(12) not null,
symptom varchar(20) not null,
primary key(sypt_id)
);
create table if not exists Medicine(
medi_id varchar(12) not null,
medi_name varchar(20) not null,
sypt_id varchar(12),
foreign key(sypt_id) references who_staging.symptom(sypt_id),
primary key(medi_id)
);
create table if not exists who_staging.FollowUp(
F_id varchar(10) not null,
pt_id varchar(15),
sypt_id varchar(12),
medi_id varchar(12),
foreign key(pt_id) references who_staging.PatientDetails(pt_id),
foreign key(sypt_id) references who_staging.symptom(sypt_id),
foreign key(medi_id) references who_staging.Medicine(medi_id),
primary key(F_id)
);
Ist diese Referenzierung richtig für die folgenden?Vier Tabellen in Beziehung, PatientDetails, Symptome, Medizin und Follow-up
- Ein Patient kann mehrere Symptome haben.
- Für ein Symptom können mehrere Medikamente gegeben werden.
- Für mehrere Symptome kann ein Arzneimittel gegeben werden.
- Ein Patient kann mehrere Nachuntersuchungen haben.
- Wenn insbesondere Follow-up no ausgewählt ist, sollte das System die Patientendetails sowie den medizinischen Patienten anzeigen, für welches Symptom er/sie leidet.
würde ich sehr zu schätzen jede Hilfe
für Anfänger ist pt_id nicht so heiß. Warum nicht für eine auto_inc int ID schießen? Wer diese Patientenidentität trotzdem zuweist und mit einer Auto_inc muss man nicht träumen – Drew