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" (
"Examination Date" DATE,
"Diagnosis" TEXT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Examination" VALUES ("1991-10-05", "Thrombosis");
INSERT INTO "Examination" VALUES ("1991-10-15", "No Thrombosis");
INSERT INTO "Examination" VALUES ("1991-11-01", "Thrombosis");
INSERT INTO "Examination" VALUES ("1990-09-20", "No Thrombosis");
INSERT INTO "Examination" VALUES ("1991-10-25", "Thrombosis");
INSERT INTO "Examination" VALUES ("1992-01-10", "No Thrombosis");
INSERT INTO "Laboratory" VALUES ("1", "1991-10-05");
INSERT INTO "Laboratory" VALUES ("2", "1991-10-15");
INSERT INTO "Laboratory" VALUES ("3", "1991-11-01");
INSERT INTO "Laboratory" VALUES ("1", "1990-09-20");
INSERT INTO "Laboratory" VALUES ("4", "1991-10-25");
INSERT INTO "Laboratory" VALUES ("2", "1992-01-10");
INSERT INTO "Laboratory" VALUES ("5", "1991-10-01");
INSERT INTO "Laboratory" VALUES ("6", "1991-10-30");
INSERT INTO "Laboratory" VALUES ("7", "1991-09-29");
INSERT INTO "Laboratory" VALUES ("8", "1991-11-01");
INSERT INTO "Patient" VALUES ("1", "1960-03-10", "1990-09-20");
INSERT INTO "Patient" VALUES ("2", "1975-07-22", "1991-10-15");
INSERT INTO "Patient" VALUES ("3", "1980-01-01", "1991-11-01");
INSERT INTO "Patient" VALUES ("4", "1955-11-05", "1991-10-25");
INSERT INTO "Patient" VALUES ("5", "1965-04-12", "1991-10-01");
INSERT INTO "Patient" VALUES ("6", "1970-09-18", "1991-10-30");
INSERT INTO "Patient" VALUES ("7", "1985-02-28", "1991-09-29");
INSERT INTO "Patient" VALUES ("8", "1962-06-01", "1991-11-01");