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,
"Symptoms" 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", "1990-05-15", "2010-01-01");
INSERT INTO "Patient" VALUES ("2", "1985-11-22", "2008-03-10");
INSERT INTO "Patient" VALUES ("3", "1995-03-01", "2012-07-05");
INSERT INTO "Patient" VALUES ("4", "2000-01-01", "2015-09-20");
INSERT INTO "Patient" VALUES ("5", "1970-08-08", "2005-02-14");
INSERT INTO "Patient" VALUES ("6", "1998-12-25", "2018-04-30");
INSERT INTO "Patient" VALUES ("7", "1999-07-10", "2019-01-15");
INSERT INTO "Examination" VALUES ("1", "2010-02-01", "Common Cold", "Cough, Sore Throat");
INSERT INTO "Examination" VALUES ("2", "2008-04-01", "Flu", "Fever, Body Aches");
INSERT INTO "Examination" VALUES ("3", "2012-08-01", "Allergies", "Sneezing, Itchy Eyes");
INSERT INTO "Examination" VALUES ("4", "2015-10-01", "Thrombosis", "Leg Swelling, Pain");
INSERT INTO "Examination" VALUES ("5", "2005-03-01", "Hypertension", "Headache");
INSERT INTO "Examination" VALUES ("6", "2018-05-01", "Migraine", "Severe Headache, Nausea");
INSERT INTO "Examination" VALUES ("7", "2019-02-01", "Thrombosis", "Shortness of Breath, Chest Pain");
INSERT INTO "Examination" VALUES ("4", "2016-03-15", "Thrombosis", "Calf Tenderness");
INSERT INTO "Examination" VALUES ("7", "2020-01-01", "Thrombosis", "NULL");
INSERT INTO "Examination" VALUES ("3", "2013-01-20", "Common Cold", "NULL");
INSERT INTO "Laboratory" VALUES ("1", "2010-02-01");
INSERT INTO "Laboratory" VALUES ("2", "2008-04-01");
INSERT INTO "Laboratory" VALUES ("3", "2012-08-01");
INSERT INTO "Laboratory" VALUES ("4", "2015-10-01");
INSERT INTO "Laboratory" VALUES ("5", "2005-03-01");
INSERT INTO "Laboratory" VALUES ("6", "2018-05-01");
INSERT INTO "Laboratory" VALUES ("7", "2019-02-01");
INSERT INTO "Laboratory" VALUES ("4", "2016-03-15");
INSERT INTO "Laboratory" VALUES ("7", "2020-01-01");
INSERT INTO "Laboratory" VALUES ("3", "2013-01-20");