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,
PRIMARY KEY ("ID", "Date")
);

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



INSERT INTO "Patient" VALUES ("821298", "2024-01-10", "Suspected thrombosis");
INSERT INTO "Patient" VALUES ("821299", "2024-01-05", "No thrombosis");
INSERT INTO "Patient" VALUES ("821300", "2024-01-12", "Suspected thrombosis");
INSERT INTO "Patient" VALUES ("821301", "2024-01-15", "No thrombosis");
INSERT INTO "Patient" VALUES ("821302", "2024-01-20", "Suspected thrombosis");
INSERT INTO "Examination" VALUES ("821298", "2024-01-12", "Confirmed thrombosis");
INSERT INTO "Examination" VALUES ("821299", "2024-01-06", "No thrombosis");
INSERT INTO "Examination" VALUES ("821300", "2024-01-15", "Confirmed thrombosis");
INSERT INTO "Examination" VALUES ("821301", "2024-01-16", "No thrombosis");
INSERT INTO "Examination" VALUES ("821302", "2024-01-25", "Confirmed thrombosis");
INSERT INTO "Laboratory" VALUES ("821298", "2024-01-11");
INSERT INTO "Laboratory" VALUES ("821299", "2024-01-05");
INSERT INTO "Laboratory" VALUES ("821300", "2024-01-13");
INSERT INTO "Laboratory" VALUES ("821301", "2024-01-15");
INSERT INTO "Laboratory" VALUES ("821302", "2024-01-22");