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



INSERT INTO "Patient" VALUES ("1", "1980-05-10", "2010-01-15");
INSERT INTO "Patient" VALUES ("2", "1975-11-22", "2012-03-01");
INSERT INTO "Patient" VALUES ("3", "1990-01-01", "2015-07-20");
INSERT INTO "Patient" VALUES ("4", "1965-03-15", "2018-09-05");
INSERT INTO "Patient" VALUES ("5", "1988-07-07", "2011-02-10");
INSERT INTO "Patient" VALUES ("6", "1995-09-30", "2013-04-25");
INSERT INTO "Patient" VALUES ("7", "1970-02-14", "2016-11-11");
INSERT INTO "Patient" VALUES ("8", "1982-04-01", "2019-01-01");
INSERT INTO "Patient" VALUES ("9", "1993-06-18", "2010-05-01");
INSERT INTO "Patient" VALUES ("10", "1960-12-25", "2017-08-12");
INSERT INTO "Examination" VALUES ("1", "2010-06-20", "Flu");
INSERT INTO "Examination" VALUES ("2", "2012-03-05", "Cold");
INSERT INTO "Examination" VALUES ("3", "2016-08-01", "Allergy");
INSERT INTO "Examination" VALUES ("4", "2018-09-10", "Check-up");
INSERT INTO "Examination" VALUES ("5", "2012-03-01", "Fever");
INSERT INTO "Examination" VALUES ("6", "2013-04-26", "Rash");
INSERT INTO "Examination" VALUES ("7", "2017-12-01", "Headache");
INSERT INTO "Examination" VALUES ("8", "2019-01-05", "Sore Throat");
INSERT INTO "Examination" VALUES ("9", "2011-05-01", "Broken Arm");
INSERT INTO "Examination" VALUES ("10", "2017-08-15", "Sprain");
INSERT INTO "Laboratory" VALUES ("1", "2010-06-20");
INSERT INTO "Laboratory" VALUES ("2", "2012-03-05");
INSERT INTO "Laboratory" VALUES ("3", "2016-08-01");
INSERT INTO "Laboratory" VALUES ("4", "2018-09-10");
INSERT INTO "Laboratory" VALUES ("5", "2012-03-01");
INSERT INTO "Laboratory" VALUES ("6", "2013-04-26");
INSERT INTO "Laboratory" VALUES ("7", "2017-12-01");
INSERT INTO "Laboratory" VALUES ("8", "2019-01-05");
INSERT INTO "Laboratory" VALUES ("9", "2011-05-01");
INSERT INTO "Laboratory" VALUES ("10", "2017-08-15");