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,
"Diagnosis" TEXT
);

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

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



INSERT INTO "Patient" VALUES ("1", "1991-06-13", "Emergency", "SJS");
INSERT INTO "Patient" VALUES ("2", "1990-05-20", "Routine", "SJS");
INSERT INTO "Patient" VALUES ("3", "1991-06-13", "Emergency", "Other");
INSERT INTO "Patient" VALUES ("4", "1992-07-15", "Routine", "SJS");
INSERT INTO "Patient" VALUES ("5", "1991-06-13", "Emergency", "SJS");
INSERT INTO "Laboratory" VALUES ("1", "1995-01-01");
INSERT INTO "Laboratory" VALUES ("1", "1995-06-15");
INSERT INTO "Laboratory" VALUES ("1", "1995-12-31");
INSERT INTO "Laboratory" VALUES ("1", "1994-12-31");
INSERT INTO "Laboratory" VALUES ("1", "1996-01-01");
INSERT INTO "Laboratory" VALUES ("2", "1995-03-10");
INSERT INTO "Laboratory" VALUES ("3", "1995-07-20");
INSERT INTO "Laboratory" VALUES ("4", "1995-08-08");
INSERT INTO "Laboratory" VALUES ("5", "1995-05-05");