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,
"CRP" TEXT,
PRIMARY KEY ("ID", "Date")
);

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



INSERT INTO "Patient" VALUES ("1", "M", "1980-05-20", "Healthy");
INSERT INTO "Patient" VALUES ("2", "F", "1995-12-15", "Thrombosis");
INSERT INTO "Patient" VALUES ("3", "M", "2000-07-30", "At Risk");
INSERT INTO "Patient" VALUES ("4", "F", "2005-03-10", "Healthy");
INSERT INTO "Patient" VALUES ("5", "M", "2010-11-25", "Thrombosis");
INSERT INTO "Examination" VALUES ("1", "No issues", "None");
INSERT INTO "Examination" VALUES ("2", "Confirmed Thrombosis", "Swelling, Pain");
INSERT INTO "Examination" VALUES ("3", "Possible Risk", "Mild pain");
INSERT INTO "Examination" VALUES ("4", "No issues", "None");
INSERT INTO "Examination" VALUES ("5", "Confirmed Thrombosis", "Severe pain, Redness");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "Normal");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-15", "High");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-20", "Slightly elevated");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-25", "Normal");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-30", "Very high");