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



INSERT INTO "Patient" VALUES ("1", "1991-06-13", "SJS");
INSERT INTO "Patient" VALUES ("2", "1992-01-01", "Flu");
INSERT INTO "Patient" VALUES ("3", "1991-06-13", "Common Cold");
INSERT INTO "Patient" VALUES ("4", "1990-05-20", "SJS");
INSERT INTO "Patient" VALUES ("5", "1991-06-13", "SJS");
INSERT INTO "Patient" VALUES ("6", "1991-06-13", "SJS");
INSERT INTO "Laboratory" VALUES ("1", "1995-01-15");
INSERT INTO "Laboratory" VALUES ("1", "1995-03-20");
INSERT INTO "Laboratory" VALUES ("1", "1995-07-01");
INSERT INTO "Laboratory" VALUES ("1", "1996-02-10");
INSERT INTO "Laboratory" VALUES ("2", "1995-04-05");
INSERT INTO "Laboratory" VALUES ("3", "1995-06-10");
INSERT INTO "Laboratory" VALUES ("4", "1995-08-22");
INSERT INTO "Laboratory" VALUES ("5", "1994-11-01");
INSERT INTO "Laboratory" VALUES ("5", "1995-01-01");
INSERT INTO "Laboratory" VALUES ("5", "1995-02-01");
INSERT INTO "Laboratory" VALUES ("6", "1995-05-05");
INSERT INTO "Laboratory" VALUES ("6", "1995-06-06");
INSERT INTO "Laboratory" VALUES ("6", "1995-07-07");
INSERT INTO "Laboratory" VALUES ("6", "1995-08-08");
INSERT INTO "Laboratory" VALUES ("6", "1996-01-01");
INSERT INTO "Examination" VALUES ("1991-06-13", "SJS", "Rash");
INSERT INTO "Examination" VALUES ("1992-01-01", "Flu", "Fever");
INSERT INTO "Examination" VALUES ("1991-06-13", "Common Cold", "Cough");
INSERT INTO "Examination" VALUES ("1990-05-20", "SJS", "Skin Lesions");
INSERT INTO "Examination" VALUES ("1991-06-13", "SJS", "Blisters");
INSERT INTO "Examination" VALUES ("1995-01-15", "SJS", "Rash");