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



INSERT INTO "Patient" VALUES ("1", "1959-03-01");
INSERT INTO "Patient" VALUES ("2", "1965-07-15");
INSERT INTO "Patient" VALUES ("3", "1970-11-22");
INSERT INTO "Patient" VALUES ("4", "1959-03-01");
INSERT INTO "Patient" VALUES ("5", "1980-01-01");
INSERT INTO "Examination" VALUES ("1", "1993-09-27", "Common Cold", "Cough, Sore Throat");
INSERT INTO "Examination" VALUES ("2", "1993-09-27", "Influenza", "Fever, Body Aches");
INSERT INTO "Examination" VALUES ("1", "1994-01-10", "Allergies", "Sneezing, Itchy Eyes");
INSERT INTO "Examination" VALUES ("3", "1993-09-27", "Migraine", "Headache, Nausea");
INSERT INTO "Examination" VALUES ("4", "1993-09-27", "Thrombosis", "Leg Swelling, Pain");
INSERT INTO "Examination" VALUES ("1", "1993-09-28", "Bronchitis", "Persistent Cough");
INSERT INTO "Examination" VALUES ("5", "1993-09-27", "Pneumonia", "Shortness of breath, Chest pain");
INSERT INTO "Laboratory" VALUES ("1", "1993-09-27");
INSERT INTO "Laboratory" VALUES ("2", "1993-09-27");
INSERT INTO "Laboratory" VALUES ("1", "1994-01-10");
INSERT INTO "Laboratory" VALUES ("3", "1993-09-27");
INSERT INTO "Laboratory" VALUES ("4", "1993-09-27");
INSERT INTO "Laboratory" VALUES ("1", "1993-09-28");
INSERT INTO "Laboratory" VALUES ("5", "1993-09-27");