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

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"GPT" INT,
"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 "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", "No Thrombosis");
INSERT INTO "Patient" VALUES ("5", "M", "Thrombosis");
INSERT INTO "Patient" VALUES ("6", "F", "Thrombosis");
INSERT INTO "Patient" VALUES ("7", "M", "No Thrombosis");
INSERT INTO "Patient" VALUES ("8", "F", "Thrombosis");
INSERT INTO "Patient" VALUES ("9", "M", "No Thrombosis");
INSERT INTO "Patient" VALUES ("10", "F", "Thrombosis");
INSERT INTO "Examination" VALUES ("1", "1990-01-15", "Thrombosis");
INSERT INTO "Examination" VALUES ("2", "1988-05-20", "No Thrombosis");
INSERT INTO "Examination" VALUES ("3", "1995-11-01", "Thrombosis");
INSERT INTO "Examination" VALUES ("4", "1987-07-01", "No Thrombosis");
INSERT INTO "Examination" VALUES ("5", "1996-02-10", "Thrombosis");
INSERT INTO "Examination" VALUES ("6", "1992-03-25", "Thrombosis");
INSERT INTO "Examination" VALUES ("7", "1991-09-10", "No Thrombosis");
INSERT INTO "Examination" VALUES ("8", "1989-04-05", "Thrombosis");
INSERT INTO "Examination" VALUES ("9", "1996-01-30", "No Thrombosis");
INSERT INTO "Examination" VALUES ("10", "1993-06-18", "Thrombosis");
INSERT INTO "Laboratory" VALUES ("1", "1990-01-15", "45", "3.5");
INSERT INTO "Laboratory" VALUES ("1", "1990-02-01", "25", "4.2");
INSERT INTO "Laboratory" VALUES ("2", "1988-05-20", "20", "4.1");
INSERT INTO "Laboratory" VALUES ("3", "1995-11-01", "35", "3.8");
INSERT INTO "Laboratory" VALUES ("3", "1995-12-01", "28", "4.0");
INSERT INTO "Laboratory" VALUES ("4", "1987-07-01", "50", "3.2");
INSERT INTO "Laboratory" VALUES ("4", "1987-07-10", "22", "4.5");
INSERT INTO "Laboratory" VALUES ("5", "1996-02-10", "40", "3.0");
INSERT INTO "Laboratory" VALUES ("6", "1992-03-25", "32", "3.9");
INSERT INTO "Laboratory" VALUES ("7", "1991-09-10", "28", "4.3");
INSERT INTO "Laboratory" VALUES ("8", "1989-04-05", "60", "2.9");
INSERT INTO "Laboratory" VALUES ("9", "1996-01-30", "38", "3.7");
INSERT INTO "Laboratory" VALUES ("10", "1993-06-18", "42", "3.6");
INSERT INTO "Laboratory" VALUES ("10", "1993-07-01", "29", "4.0");