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 "Patient" VALUES ("6", "No thrombosis");
INSERT INTO "Examination" VALUES ("1", "12.5", "150");
INSERT INTO "Examination" VALUES ("2", "8.0", "200");
INSERT INTO "Examination" VALUES ("3", "15.0", "180");
INSERT INTO "Examination" VALUES ("4", "7.5", "200");
INSERT INTO "Examination" VALUES ("5", "10.0", "170");
INSERT INTO "Examination" VALUES ("6", "9.0", "190");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "45", "1.8");
INSERT INTO "Laboratory" VALUES ("1", "2024-02-15", "50", "1.9");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-12", "40", "1.7");
INSERT INTO "Laboratory" VALUES ("2", "2024-03-10", "42", "1.9");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-20", "38", "1.5");
INSERT INTO "Laboratory" VALUES ("3", "2024-02-25", "39", "1.6");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-18", "44", "1.9");
INSERT INTO "Laboratory" VALUES ("4", "2024-03-05", "43", "1.9");
INSERT INTO "Laboratory" VALUES ("5", "2024-02-01", "41", "1.4");
INSERT INTO "Laboratory" VALUES ("5", "2024-03-15", "40", "1.3");
INSERT INTO "Laboratory" VALUES ("6", "2024-01-22", "46", "1.8");
INSERT INTO "Laboratory" VALUES ("6", "2024-02-28", "47", "1.7");