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

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

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



INSERT INTO "Patient" VALUES ("1", "1980-05-20", "2020-01-10");
INSERT INTO "Patient" VALUES ("2", "1975-11-15", "2019-06-01");
INSERT INTO "Patient" VALUES ("3", "1990-07-30", "2021-03-20");
INSERT INTO "Patient" VALUES ("4", "1985-12-05", "2018-09-15");
INSERT INTO "Patient" VALUES ("5", "2000-01-01", "2022-02-28");
INSERT INTO "Patient" VALUES ("6", "1995-04-10", "2020-12-31");
INSERT INTO "Patient" VALUES ("7", "1960-08-22", "2017-07-07");
INSERT INTO "Patient" VALUES ("8", "1988-03-14", "2019-11-11");
INSERT INTO "Patient" VALUES ("9", "1970-10-10", "2016-05-05");
INSERT INTO "Patient" VALUES ("10", "1992-09-09", "2021-01-01");
INSERT INTO "Examination" VALUES ("1", "2021-02-15");
INSERT INTO "Examination" VALUES ("2", "2019-06-01");
INSERT INTO "Examination" VALUES ("3", "2021-03-19");
INSERT INTO "Examination" VALUES ("4", "2019-10-01");
INSERT INTO "Examination" VALUES ("5", "2022-02-28");
INSERT INTO "Examination" VALUES ("6", "2022-01-01");
INSERT INTO "Examination" VALUES ("7", "2018-07-08");
INSERT INTO "Examination" VALUES ("8", "2020-11-10");
INSERT INTO "Examination" VALUES ("9", "2017-05-05");
INSERT INTO "Laboratory" VALUES ("1", "2020-01-15");
INSERT INTO "Laboratory" VALUES ("2", "2019-06-02");
INSERT INTO "Laboratory" VALUES ("3", "2021-03-21");
INSERT INTO "Laboratory" VALUES ("4", "2018-09-16");
INSERT INTO "Laboratory" VALUES ("5", "2022-03-01");
INSERT INTO "Laboratory" VALUES ("6", "2021-01-01");
INSERT INTO "Laboratory" VALUES ("7", "2017-07-10");
INSERT INTO "Laboratory" VALUES ("8", "2019-11-12");
INSERT INTO "Laboratory" VALUES ("9", "2016-05-06");
INSERT INTO "Laboratory" VALUES ("10", "2021-01-02");