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

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"GOT" INT,
"GPT" INT,
"ALB" 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 "Patient" VALUES ("7", "Thrombosis");
INSERT INTO "Patient" VALUES ("8", "No thrombosis");
INSERT INTO "Examination" VALUES ("1", "1987-07-06", "12.5");
INSERT INTO "Examination" VALUES ("2", "1990-05-20", "8.0");
INSERT INTO "Examination" VALUES ("3", "1995-12-31", "15.2");
INSERT INTO "Examination" VALUES ("4", "1988-01-15", "7.8");
INSERT INTO "Examination" VALUES ("5", "1996-01-31", "9.1");
INSERT INTO "Examination" VALUES ("6", "1986-12-31", "10.0");
INSERT INTO "Examination" VALUES ("7", "1992-03-10", "11.3");
INSERT INTO "Examination" VALUES ("8", "1997-02-01", "13.7");
INSERT INTO "Laboratory" VALUES ("1", "1987-07-06", "25", "31", "3.9");
INSERT INTO "Laboratory" VALUES ("2", "1990-05-20", "40", "35", "3.5");
INSERT INTO "Laboratory" VALUES ("3", "1995-12-31", "30", "29", "3.8");
INSERT INTO "Laboratory" VALUES ("4", "1988-01-15", "20", "32", "4.1");
INSERT INTO "Laboratory" VALUES ("5", "1996-01-31", "22", "33", "3.7");
INSERT INTO "Laboratory" VALUES ("6", "1986-12-31", "50", "40", "3.6");
INSERT INTO "Laboratory" VALUES ("7", "1992-03-10", "28", "31", "3.9");
INSERT INTO "Laboratory" VALUES ("8", "1997-02-01", "35", "38", "3.4");