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,
"aCL IgG" FLOAT,
"aCL IgA" INT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"UN" INT,
"CRE" FLOAT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Patient" VALUES ("1", "Thrombosis");
INSERT INTO "Patient" VALUES ("2", "No Thrombosis");
INSERT INTO "Patient" VALUES ("3", "Thrombosis");
INSERT INTO "Patient" VALUES ("4", "No Thrombosis");
INSERT INTO "Patient" VALUES ("5", "Thrombosis");
INSERT INTO "Patient" VALUES ("6", "No Thrombosis");
INSERT INTO "Examination" VALUES ("1", "10.5", "150");
INSERT INTO "Examination" VALUES ("2", "5.2", "80");
INSERT INTO "Examination" VALUES ("3", "12.1", "200");
INSERT INTO "Examination" VALUES ("4", "8.9", "120");
INSERT INTO "Examination" VALUES ("5", "11.0", "200");
INSERT INTO "Examination" VALUES ("6", "6.7", "90");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "20", "1.2");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-16", "15", "0.9");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-17", "25", "1.8");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-18", "18", "1.1");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-19", "22", "1.3");
INSERT INTO "Laboratory" VALUES ("6", "2023-01-20", "16", "0.8");