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,
"SEX" TEXT,
"First Date" DATE,
"Diagnosis" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "F", "1995-03-10", "Hypertension");
INSERT INTO "Patient" VALUES ("2", "M", "1996-07-20", "Diabetes");
INSERT INTO "Patient" VALUES ("3", "F", "1997-01-27", "SLE");
INSERT INTO "Patient" VALUES ("4", "M", "1998-05-15", "Asthma");
INSERT INTO "Patient" VALUES ("5", "F", "1997-01-27", "Migraine");
INSERT INTO "Patient" VALUES ("6", "M", "1999-11-01", "Arthritis");
INSERT INTO "Patient" VALUES ("7", "F", "1997-01-27", "Common Cold");
INSERT INTO "Examination" VALUES ("1", "1995-03-10", "Hypertension", "Headache");
INSERT INTO "Examination" VALUES ("2", "1996-07-20", "Diabetes", "Fatigue");
INSERT INTO "Examination" VALUES ("3", "1997-01-27", "SLE", "Joint Pain");
INSERT INTO "Examination" VALUES ("4", "1998-05-15", "Asthma", "Shortness of Breath");
INSERT INTO "Examination" VALUES ("5", "1997-01-27", "Migraine", "Severe Headache");
INSERT INTO "Examination" VALUES ("3", "1997-03-01", "SLE", "Rash");
INSERT INTO "Examination" VALUES ("1", "1996-01-05", "Hypertension", "Dizziness");
INSERT INTO "Examination" VALUES ("6", "1999-11-01", "Arthritis", "Swollen Joints");
INSERT INTO "Examination" VALUES ("7", "1997-01-27", "Common Cold", "Cough");
INSERT INTO "Laboratory" VALUES ("1", "1995-03-10");
INSERT INTO "Laboratory" VALUES ("2", "1996-07-20");
INSERT INTO "Laboratory" VALUES ("3", "1997-01-27");
INSERT INTO "Laboratory" VALUES ("4", "1998-05-15");
INSERT INTO "Laboratory" VALUES ("5", "1997-01-27");
INSERT INTO "Laboratory" VALUES ("3", "1997-02-15");
INSERT INTO "Laboratory" VALUES ("1", "1996-01-05");
INSERT INTO "Laboratory" VALUES ("6", "1999-11-01");
INSERT INTO "Laboratory" VALUES ("7", "1997-01-27");