· 6 years ago · Oct 08, 2019, 09:06 AM
1DROP TABLE IF EXISTS Medical_Site ; CREATE TABLE Medical_Site (id_Medical_Site BIGINT AUTO_INCREMENT NOT NULL, name_Medical_Site VARCHAR, id_Address **NOT FOUND**, PRIMARY KEY (id_Medical_Site)) ENGINE=InnoDB; DROP TABLE IF EXISTS Doctor ; CREATE TABLE Doctor (id_Doctor BIGINT AUTO_INCREMENT NOT NULL, CDHP_Doctor BIGINT, gps_coordonate_id_gps coordonate **NOT FOUND**, social_details_id_social_details **NOT FOUND**, PRIMARY KEY (id_Doctor)) ENGINE=InnoDB; DROP TABLE IF EXISTS Profession_Type ; CREATE TABLE Profession_Type (id_Profession_Type BIGINT AUTO_INCREMENT NOT NULL, name_Profession_Type VARCHAR, PRIMARY KEY (id_Profession_Type)) ENGINE=InnoDB; DROP TABLE IF EXISTS Tag ; CREATE TABLE Tag (id_Tag BIGINT AUTO_INCREMENT NOT NULL, name_Tag VARCHAR, type_Tag VARCHAR, PRIMARY KEY (id_Tag)) ENGINE=InnoDB; DROP TABLE IF EXISTS Doctor_Diagnostic ; CREATE TABLE Doctor_Diagnostic (id_Doctor_Diagnostic BIGINT AUTO_INCREMENT NOT NULL, title_Doctor_Diagnostic VARCHAR, report_Doctor_Diagnostic VARCHAR, gravityGrade_Doctor_Diagnostic TINYINT, date_Doctor_Diagnostic DATE, id_Patient_Medical_Record **NOT FOUND**, id_Doctor **NOT FOUND**, PRIMARY KEY (id_Doctor_Diagnostic)) ENGINE=InnoDB; DROP TABLE IF EXISTS Patient_Medical_Record ; CREATE TABLE Patient_Medical_Record (id_Patient_Medical_Record BIGINT AUTO_INCREMENT NOT NULL, height_Patient_Medical_Record SMALLINT, weight_Patient_Medical_Record SMALLINT, socialSecurityNumber_Patient_Medical_Record VARCHAR, id_Blood_Group **NOT FOUND**, gps_coordonate_id_gps coordonate **NOT FOUND**, id_Address **NOT FOUND**, social_details_id_social_details **NOT FOUND**, doctor_id_doctor **NOT FOUND**, PRIMARY KEY (id_Patient_Medical_Record)) ENGINE=InnoDB; DROP TABLE IF EXISTS Blood_Group ; CREATE TABLE Blood_Group (id_Blood_Group TINYINT AUTO_INCREMENT NOT NULL, name_Blood_Group VARCHAR, PRIMARY KEY (id_Blood_Group)) ENGINE=InnoDB; DROP TABLE IF EXISTS Authentification ; CREATE TABLE Authentification (id_Authentification BIGINT AUTO_INCREMENT NOT NULL, username_Authentification VARCHAR, mail_Authentification VARCHAR, password_Authentification VARCHAR, keystrokeSpeed_Authentification SMALLINT, isAdmin_Authentification BOOL, isDoctor_Authentification BOOL, PRIMARY KEY (id_Authentification)) ENGINE=InnoDB; DROP TABLE IF EXISTS GPS_coordonate ; CREATE TABLE GPS_coordonate (id_GPS_coordonate BIGINT AUTO_INCREMENT NOT NULL, latitude_GPS coordonate FLOAT, longitude_GPS coordonate FLOAT, patient_medical_record_id_patient_medical_record **NOT FOUND**, doctor_id_doctor **NOT FOUND**, PRIMARY KEY (id_GPS_coordonate)) ENGINE=InnoDB; DROP TABLE IF EXISTS Address ; CREATE TABLE Address (id_Address BIGINT AUTO_INCREMENT NOT NULL, number_Address SMALLINT, street_Address VARCHAR, zipcode_Address VARCHAR, PRIMARY KEY (id_Address)) ENGINE=InnoDB; DROP TABLE IF EXISTS Social_Details ; CREATE TABLE Social_Details (id_Social_Details BIGINT AUTO_INCREMENT NOT NULL, firstname_Social_Details VARCHAR, lastname_Social_Details VARCHAR, sex_Social_Details BOOL, birth_Social_Details DATE, birthZipcode_Social_Details INT, phoneNumber_Social_Details VARCHAR, picture_Social_Details BLOB, doctor_id_doctor **NOT FOUND**, patient_medical_record_id_patient_medical_record **NOT FOUND**, PRIMARY KEY (id_Social_Details)) ENGINE=InnoDB; DROP TABLE IF EXISTS Imagery ; CREATE TABLE Imagery (id_Imagery BIGINT AUTO_INCREMENT NOT NULL, name_Imagery VARCHAR, image_Imagery BLOB, id_Doctor_Diagnostic **NOT FOUND**, PRIMARY KEY (id_Imagery)) ENGINE=InnoDB; DROP TABLE IF EXISTS Numerical ; CREATE TABLE Numerical (id_Numerical BIGINT AUTO_INCREMENT NOT NULL, name_Numerical VARCHAR, value_Numerical FLOAT, id_Doctor_Diagnostic **NOT FOUND**, PRIMARY KEY (id_Numerical)) ENGINE=InnoDB; DROP TABLE IF EXISTS Appoitement ; CREATE TABLE Appoitement (id_Appoitement BIGINT AUTO_INCREMENT NOT NULL, date_Appoitement DATE, id_Doctor **NOT FOUND**, id_Patient_Medical_Record **NOT FOUND**, address_id_address **NOT FOUND**, gps_coordonate_id_gps coordonate **NOT FOUND**, PRIMARY KEY (id_Appoitement)) ENGINE=InnoDB; DROP TABLE IF EXISTS practise ; CREATE TABLE practise (id_Doctor **NOT FOUND** AUTO_INCREMENT NOT NULL, id_Profession_Type **NOT FOUND** NOT NULL, PRIMARY KEY (id_Doctor, id_Profession_Type)) ENGINE=InnoDB; DROP TABLE IF EXISTS belong ; CREATE TABLE belong (id_Medical Site **NOT FOUND** AUTO_INCREMENT NOT NULL, id_Doctor **NOT FOUND** NOT NULL, PRIMARY KEY (id_Medical_Site, id_Doctor)) ENGINE=InnoDB; DROP TABLE IF EXISTS discribe ; CREATE TABLE discribe (id_Doctor_Diagnostic **NOT FOUND** AUTO_INCREMENT NOT NULL, id_Tag **NOT FOUND** NOT NULL, PRIMARY KEY (id_Doctor_Diagnostic, id_Tag)) ENGINE=InnoDB; DROP TABLE IF EXISTS login ; CREATE TABLE login (id_Patient_Medical_Record **NOT FOUND** AUTO_INCREMENT NOT NULL, id_Authentification **NOT FOUND** NOT NULL, id_Doctor **NOT FOUND** NOT NULL, PRIMARY KEY (id_Patient_Medical_Record, id_Authentification, id_Doctor)) ENGINE=InnoDB; DROP TABLE IF EXISTS provide ; CREATE TABLE provide (id_Medical Site **NOT FOUND** AUTO_INCREMENT NOT NULL, id_Tag **NOT FOUND** NOT NULL, PRIMARY KEY (id_Medical_Site, id_Tag)) ENGINE=InnoDB; ALTER TABLE Medical_Site ADD CONSTRAINT FK_Medical_Site_id_Address FOREIGN KEY (id_Address) REFERENCES Address (id_Address); ALTER TABLE Doctor ADD CONSTRAINT FK_Doctor_gps_coordonate_id_gps_coordonate FOREIGN KEY (gps_coordonate_id_gps_coordonate) REFERENCES GPS_coordonate (id_GPS_coordonate); ALTER TABLE Doctor ADD CONSTRAINT FK_Doctor_social_details_id_social_details FOREIGN KEY (social_details_id_social_details) REFERENCES Social_Details (id_Social_Details); ALTER TABLE Doctor_Diagnostic ADD CONSTRAINT FK_Doctor_Diagnostic_id_Patient_Medical_Record FOREIGN KEY (id_Patient_Medical_Record) REFERENCES Patient_Medical_Record (id_Patient_Medical_Record); ALTER TABLE Doctor_Diagnostic ADD CONSTRAINT FK_Doctor_Diagnostic_id_Doctor FOREIGN KEY (id_Doctor) REFERENCES Doctor (id_Doctor); ALTER TABLE Patient_Medical_Record ADD CONSTRAINT FK_Patient_Medical_Record_id_Blood_Group FOREIGN KEY (id_Blood_Group) REFERENCES Blood_Group (id_Blood_Group); ALTER TABLE Patient_Medical_Record ADD CONSTRAINT FK_Patient_Medical_Record_gps_coordonate_id_gps_coordonate FOREIGN KEY (gps_coordonate_id_gps_coordonate) REFERENCES GPS_coordonate (id_GPS_coordonate); ALTER TABLE Patient_Medical_Record ADD CONSTRAINT FK_Patient_Medical_Record_id_Address FOREIGN KEY (id_Address) REFERENCES Address (id_Address); ALTER TABLE Patient_Medical_Record ADD CONSTRAINT FK_Patient_Medical_Record_social_details_id_social_details FOREIGN KEY (social_details_id_social_details) REFERENCES Social_Details (id_Social_Details); ALTER TABLE Patient_Medical_Record ADD CONSTRAINT FK_Patient_Medical_Record_doctor_id_doctor FOREIGN KEY (doctor_id_doctor) REFERENCES Doctor (id_Doctor); ALTER TABLE GPS_coordonate ADD CONSTRAINT FK_GPS_coordonate_patient_medical_record_id_patient_medical_record FOREIGN KEY (patient_medical_record_id_patient_medical_record) REFERENCES Patient_Medical_Record (id_Patient_Medical_Record); ALTER TABLE GPS_coordonate ADD CONSTRAINT FK_GPS_coordonate_doctor_id_doctor FOREIGN KEY (doctor_id_doctor) REFERENCES Doctor (id_Doctor); ALTER TABLE Social_Details ADD CONSTRAINT FK_Social_Details_doctor_id_doctor FOREIGN KEY (doctor_id_doctor) REFERENCES Doctor (id_Doctor); ALTER TABLE Social_Details ADD CONSTRAINT FK_Social_Details_patient_medical_record_id_patient_medical_record FOREIGN KEY (patient_medical_record_id_patient_medical_record) REFERENCES Patient_Medical_Record (id_Patient_Medical_Record); ALTER TABLE Imagery ADD CONSTRAINT FK_Imagery_id_Doctor_Diagnostic FOREIGN KEY (id_Doctor_Diagnostic) REFERENCES Doctor_Diagnostic (id_Doctor_Diagnostic); ALTER TABLE Numerical ADD CONSTRAINT FK_Numerical_id_Doctor_Diagnostic FOREIGN KEY (id_Doctor_Diagnostic) REFERENCES Doctor_Diagnostic (id_Doctor_Diagnostic); ALTER TABLE Appoitement ADD CONSTRAINT FK_Appoitement_id_Doctor FOREIGN KEY (id_Doctor) REFERENCES Doctor (id_Doctor); ALTER TABLE Appoitement ADD CONSTRAINT FK_Appoitement_id_Patient_Medical_Record FOREIGN KEY (id_Patient_Medical_Record) REFERENCES Patient_Medical_Record (id_Patient_Medical_Record); ALTER TABLE Appoitement ADD CONSTRAINT FK_Appoitement_address_id_address FOREIGN KEY (address_id_address) REFERENCES Address (id_Address); ALTER TABLE Appoitement ADD CONSTRAINT FK_Appoitement_gps_coordonate_id_gps_coordonate FOREIGN KEY (gps_coordonate_id_gps_coordonate) REFERENCES GPS_coordonate (id_GPS_coordonate); ALTER TABLE practise ADD CONSTRAINT FK_practise_id_Doctor FOREIGN KEY (id_Doctor) REFERENCES Doctor (id_Doctor); ALTER TABLE practise ADD CONSTRAINT FK_practise_id_Profession_Type FOREIGN KEY (id_Profession_Type) REFERENCES Profession_Type (id_Profession_Type); ALTER TABLE belong ADD CONSTRAINT FK_belong_id_Medical_Site FOREIGN KEY (id_Medical_Site) REFERENCES Medical_Site (id_Medical_Site); ALTER TABLE belong ADD CONSTRAINT FK_belong_id_Doctor FOREIGN KEY (id_Doctor) REFERENCES Doctor (id_Doctor); ALTER TABLE discribe ADD CONSTRAINT FK_discribe_id_Doctor_Diagnostic FOREIGN KEY (id_Doctor_Diagnostic) REFERENCES Doctor_Diagnostic (id_Doctor_Diagnostic); ALTER TABLE discribe ADD CONSTRAINT FK_discribe_id_Tag FOREIGN KEY (id_Tag) REFERENCES Tag (id_Tag); ALTER TABLE login ADD CONSTRAINT FK_login_id_Patient_Medical_Record FOREIGN KEY (id_Patient_Medical_Record) REFERENCES Patient_Medical_Record (id_Patient_Medical_Record); ALTER TABLE login ADD CONSTRAINT FK_login_id_Authentification FOREIGN KEY (id_Authentification) REFERENCES Authentification (id_Authentification); ALTER TABLE login ADD CONSTRAINT FK_login_id_Doctor FOREIGN KEY (id_Doctor) REFERENCES Doctor (id_Doctor); ALTER TABLE provide ADD CONSTRAINT FK_provide_id_Medical_Site FOREIGN KEY (id_Medical_Site) REFERENCES Medical_Site (id_Medical_Site); ALTER TABLE provide ADD CONSTRAINT FK_provide_id_Tag FOREIGN KEY (id_Tag) REFERENCES Tag (id_Tag);