SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
-- Таблица пациентов CREATE TABLE Patients ( PatientID INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT NOT NULL, Gender TEXT CHECK(Gender IN ('Male', 'Female', 'Other')) NOT NULL, BirthDate DATE NOT NULL, Address TEXT NOT NULL ); -- Таблица врачей CREATE TABLE Doctors ( DoctorID INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT NOT NULL ); -- Таблица осмотров CREATE TABLE Examinations ( ExaminationID INTEGER PRIMARY KEY AUTOINCREMENT, PatientID INTEGER NOT NULL, DoctorID INTEGER NOT NULL, ExaminationDate DATE NOT NULL, Location TEXT NOT NULL, Symptoms TEXT NOT NULL, Diagnosis TEXT NOT NULL, Prescription TEXT, FOREIGN KEY (PatientID) REFERENCES Patients(PatientID), FOREIGN KEY (DoctorID) REFERENCES Doctors(DoctorID) ); -- Таблица лекарств CREATE TABLE Medications ( MedicationID INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT NOT NULL, UsageInstructions TEXT NOT NULL, Description TEXT, SideEffects TEXT ); -- Таблица назначения лекарств CREATE TABLE Prescriptions ( PrescriptionID INTEGER PRIMARY KEY AUTOINCREMENT, ExaminationID INTEGER NOT NULL, MedicationID INTEGER NOT NULL, FOREIGN KEY (ExaminationID) REFERENCES Examinations(ExaminationID), FOREIGN KEY (MedicationID) REFERENCES Medications(MedicationID) );

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear