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

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("48473");
INSERT INTO "Patient" VALUES ("12345");
INSERT INTO "Patient" VALUES ("67890");
INSERT INTO "Patient" VALUES ("11223");
INSERT INTO "Patient" VALUES ("98765");
INSERT INTO "Examination" VALUES ("48473", "2023-01-10", "Normal");
INSERT INTO "Examination" VALUES ("12345", "2023-02-15", "Thrombosis");
INSERT INTO "Examination" VALUES ("67890", "2023-03-01", "Normal");
INSERT INTO "Examination" VALUES ("48473", "2023-04-20", "Suspected Thrombosis");
INSERT INTO "Examination" VALUES ("11223", "2023-05-05", "Normal");
INSERT INTO "Examination" VALUES ("98765", "2023-06-10", "Thrombosis");
INSERT INTO "Laboratory" VALUES ("48473", "2023-01-11", "45");
INSERT INTO "Laboratory" VALUES ("48473", "2023-02-01", "62");
INSERT INTO "Laboratory" VALUES ("12345", "2023-02-16", "70");
INSERT INTO "Laboratory" VALUES ("67890", "2023-03-02", "55");
INSERT INTO "Laboratory" VALUES ("48473", "2023-04-21", "80");
INSERT INTO "Laboratory" VALUES ("48473", "2023-05-10", "58");
INSERT INTO "Laboratory" VALUES ("11223", "2023-05-06", "50");
INSERT INTO "Laboratory" VALUES ("98765", "2023-06-11", "65");
INSERT INTO "Laboratory" VALUES ("48473", "2023-07-01", "60");
INSERT INTO "Laboratory" VALUES ("48473", "2023-08-15", "59");