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" (
"Examination Date" DATE,
"Diagnosis" TEXT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"LDH" INT,
"CRP" TEXT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"First Date" DATE,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "2023-01-10");
INSERT INTO "Patient" VALUES ("2", "2023-02-15");
INSERT INTO "Patient" VALUES ("3", "2023-01-05");
INSERT INTO "Patient" VALUES ("4", "2023-03-20");
INSERT INTO "Patient" VALUES ("5", "2023-01-01");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "480", "Normal");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "470", "Normal");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-15", "300", "Elevated");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-20", "320", "Elevated");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-05", "499", "Normal");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-10", "450", "Normal");
INSERT INTO "Laboratory" VALUES ("4", "2023-03-20", "510", "High");
INSERT INTO "Laboratory" VALUES ("4", "2023-03-25", "520", "High");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-01", "480", "Normal");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-05", "470", "Normal");
INSERT INTO "Examination" VALUES ("2023-01-10", "Negative");
INSERT INTO "Examination" VALUES ("2023-01-15", "Negative");
INSERT INTO "Examination" VALUES ("2023-02-15", "Positive");
INSERT INTO "Examination" VALUES ("2023-02-20", "Positive");
INSERT INTO "Examination" VALUES ("2023-01-05", "Negative");
INSERT INTO "Examination" VALUES ("2023-01-10", "Negative");
INSERT INTO "Examination" VALUES ("2023-03-20", "Positive");
INSERT INTO "Examination" VALUES ("2023-03-25", "Positive");
INSERT INTO "Examination" VALUES ("2023-01-01", "Negative");
INSERT INTO "Examination" VALUES ("2023-01-05", "Negative");