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

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"Birthday" DATE,
"First Date" DATE,
"Diagnosis" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "1980-01-15", "2020-03-10", "Normal");
INSERT INTO "Patient" VALUES ("2", "1975-05-20", "2021-01-25", "Thrombosis");
INSERT INTO "Patient" VALUES ("3", "1990-11-01", "2019-07-12", "Normal");
INSERT INTO "Patient" VALUES ("4", "1968-03-22", "2022-02-01", "Thrombosis");
INSERT INTO "Patient" VALUES ("5", "1985-09-10", "2022-02-01", "Normal");
INSERT INTO "Patient" VALUES ("6", "1972-06-30", "2022-02-01", "Thrombosis");
INSERT INTO "Patient" VALUES ("7", "1995-02-18", "2021-11-05", "Normal");
INSERT INTO "Patient" VALUES ("8", "1960-08-05", "2022-02-01", "Thrombosis");
INSERT INTO "Laboratory" VALUES ("1", "2020-03-10", "200");
INSERT INTO "Laboratory" VALUES ("1", "2020-04-01", "250");
INSERT INTO "Laboratory" VALUES ("2", "2021-01-25", "550");
INSERT INTO "Laboratory" VALUES ("2", "2021-02-10", "600");
INSERT INTO "Laboratory" VALUES ("3", "2019-07-12", "300");
INSERT INTO "Laboratory" VALUES ("4", "2022-02-01", "700");
INSERT INTO "Laboratory" VALUES ("4", "2022-02-15", "650");
INSERT INTO "Laboratory" VALUES ("5", "2022-02-01", "400");
INSERT INTO "Laboratory" VALUES ("6", "2022-02-01", "500");
INSERT INTO "Laboratory" VALUES ("7", "2021-11-05", "350");
INSERT INTO "Laboratory" VALUES ("8", "2022-02-01", "800");
INSERT INTO "Examination" VALUES ("1", "2020-03-15", "No Thrombosis");
INSERT INTO "Examination" VALUES ("2", "2021-01-30", "Confirmed Thrombosis");
INSERT INTO "Examination" VALUES ("3", "2019-07-20", "No Thrombosis");
INSERT INTO "Examination" VALUES ("4", "2022-02-05", "Confirmed Thrombosis");
INSERT INTO "Examination" VALUES ("5", "2022-02-05", "No Thrombosis");
INSERT INTO "Examination" VALUES ("6", "2022-02-05", "Confirmed Thrombosis");
INSERT INTO "Examination" VALUES ("7", "2021-11-10", "No Thrombosis");
INSERT INTO "Examination" VALUES ("8", "2022-02-05", "Confirmed Thrombosis");