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
);

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 "Patient" VALUES ("1", "2000-05-15", "2018-06-01");
INSERT INTO "Patient" VALUES ("2", "1995-12-30", "2015-01-15");
INSERT INTO "Patient" VALUES ("3", "2010-07-20", "2018-07-19");
INSERT INTO "Patient" VALUES ("4", "2005-03-10", "2010-03-09");
INSERT INTO "Patient" VALUES ("5", "2012-11-25", "2018-11-24");
INSERT INTO "Patient" VALUES ("6", "2008-01-01", "2016-12-31");
INSERT INTO "Laboratory" VALUES ("1", "2018-06-02");
INSERT INTO "Laboratory" VALUES ("2", "2015-01-16");
INSERT INTO "Laboratory" VALUES ("3", "2018-07-20");
INSERT INTO "Laboratory" VALUES ("4", "2010-03-10");
INSERT INTO "Laboratory" VALUES ("5", "2018-11-25");
INSERT INTO "Laboratory" VALUES ("6", "2017-01-01");
INSERT INTO "Examination" VALUES ("2018-06-01");
INSERT INTO "Examination" VALUES ("2015-01-15");
INSERT INTO "Examination" VALUES ("2018-07-19");
INSERT INTO "Examination" VALUES ("2010-03-09");
INSERT INTO "Examination" VALUES ("2018-11-24");
INSERT INTO "Examination" VALUES ("2016-12-31");