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", "Flu");
INSERT INTO "Patient" VALUES ("3", "1991-06-13", "Emergency", "Asthma");
INSERT INTO "Patient" VALUES ("4", "1992-07-15", "Emergency", "SJS");
INSERT INTO "Patient" VALUES ("5", "1991-06-13", "Routine", "SJS");
INSERT INTO "Examination" VALUES ("1991-06-14", "SJS");
INSERT INTO "Examination" VALUES ("1992-01-10", "Flu");
INSERT INTO "Examination" VALUES ("1993-03-05", "Asthma");
INSERT INTO "Examination" VALUES ("1994-08-20", "SJS");
INSERT INTO "Examination" VALUES ("1995-02-15", "SJS");
INSERT INTO "Laboratory" VALUES ("1", "1994-12-31");
INSERT INTO "Laboratory" VALUES ("1", "1995-01-10");
INSERT INTO "Laboratory" VALUES ("1", "1995-03-15");
INSERT INTO "Laboratory" VALUES ("1", "1995-07-22");
INSERT INTO "Laboratory" VALUES ("1", "1995-12-30");
INSERT INTO "Laboratory" VALUES ("1", "1996-01-01");
INSERT INTO "Laboratory" VALUES ("2", "1995-05-05");
INSERT INTO "Laboratory" VALUES ("3", "1995-06-06");
INSERT INTO "Laboratory" VALUES ("4", "1995-07-07");
INSERT INTO "Laboratory" VALUES ("5", "1995-08-08");
INSERT INTO "Laboratory" VALUES ("5", "1995-09-09");
INSERT INTO "Laboratory" VALUES ("5", "1995-10-10");
INSERT INTO "Laboratory" VALUES ("5", "1994-11-11");