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,
"ANA" INT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"GPT" INT,
"T-BIL" FLOAT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Patient" (
"ID" INT,
"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 "Examination" VALUES ("1", "12.5", "150");
INSERT INTO "Examination" VALUES ("2", "8.0", "200");
INSERT INTO "Examination" VALUES ("3", "10.0", "180");
INSERT INTO "Examination" VALUES ("4", "9.5", "220");
INSERT INTO "Examination" VALUES ("5", "11.0", "175");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "45", "1.8");
INSERT INTO "Laboratory" VALUES ("1", "2024-02-10", "50", "1.9");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-15", "40", "1.5");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-20", "55", "1.7");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-25", "60", "1.95");
INSERT INTO "Laboratory" VALUES ("5", "2024-01-30", "65", "2.1");
INSERT INTO "Laboratory" VALUES ("5", "2024-02-05", "70", "2.5");