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,
"ALB" FLOAT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Examination" VALUES ("2023-01-15", "Thrombosis");
INSERT INTO "Examination" VALUES ("2023-01-20", "No Thrombosis");
INSERT INTO "Examination" VALUES ("2023-02-01", "Thrombosis");
INSERT INTO "Examination" VALUES ("2023-02-10", "Other Condition");
INSERT INTO "Examination" VALUES ("2023-03-05", "Thrombosis");
INSERT INTO "Examination" VALUES ("2023-03-10", "No Thrombosis");
INSERT INTO "Patient" VALUES ("1", "M", "Thrombosis");
INSERT INTO "Patient" VALUES ("2", "F", "No Thrombosis");
INSERT INTO "Patient" VALUES ("3", "M", "Thrombosis");
INSERT INTO "Patient" VALUES ("4", "F", "Other Condition");
INSERT INTO "Patient" VALUES ("5", "M", "Thrombosis");
INSERT INTO "Patient" VALUES ("6", "F", "No Thrombosis");
INSERT INTO "Patient" VALUES ("7", "M", "Thrombosis");
INSERT INTO "Patient" VALUES ("8", "F", "Other Condition");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "3.2");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-12", "3.6");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-18", "4.0");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-25", "3.1");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-28", "3.4");
INSERT INTO "Laboratory" VALUES ("4", "2023-02-05", "3.8");
INSERT INTO "Laboratory" VALUES ("5", "2023-02-28", "3.0");
INSERT INTO "Laboratory" VALUES ("5", "2023-03-02", "3.5");
INSERT INTO "Laboratory" VALUES ("6", "2023-03-08", "4.1");
INSERT INTO "Laboratory" VALUES ("7", "2023-03-15", "3.3");
INSERT INTO "Laboratory" VALUES ("8", "2023-03-20", "3.7");