PRAGMA foreign_keys = ON;

PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ("table", "index", "trigger");
PRAGMA writable_schema = 0;
VACUUM;

CREATE TABLE "Examination" (
"ID" INT,
"Diagnosis" TEXT,
"Symptoms" TEXT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
PRIMARY KEY ("ID", "Date")
);

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"SEX" TEXT,
"Description" DATE,
"Diagnosis" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("48473", "F", "2022-01-15", "Thrombosis");
INSERT INTO "Patient" VALUES ("10001", "M", "2021-03-20", "Flu");
INSERT INTO "Patient" VALUES ("20002", "F", "2023-05-10", "Diabetes");
INSERT INTO "Patient" VALUES ("30003", "M", "2020-11-01", "Hypertension");
INSERT INTO "Patient" VALUES ("40004", "F", "2022-07-25", "Asthma");
INSERT INTO "Examination" VALUES ("48473", "Thrombosis", "Leg swelling, pain");
INSERT INTO "Examination" VALUES ("10001", "Flu", "Fever, cough");
INSERT INTO "Examination" VALUES ("20002", "Diabetes", "Frequent urination");
INSERT INTO "Examination" VALUES ("30003", "Hypertension", "Headache");
INSERT INTO "Examination" VALUES ("40004", "Asthma", "Shortness of breath");
INSERT INTO "Laboratory" VALUES ("48473", "2022-01-15");
INSERT INTO "Laboratory" VALUES ("48473", "2022-01-20");
INSERT INTO "Laboratory" VALUES ("10001", "2021-03-20");
INSERT INTO "Laboratory" VALUES ("20002", "2023-05-10");
INSERT INTO "Laboratory" VALUES ("30003", "2020-11-01");
INSERT INTO "Laboratory" VALUES ("40004", "2022-07-25");