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,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"CRP" TEXT,
PRIMARY KEY ("ID", "Date")
);

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"SEX" TEXT,
"Diagnosis" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "M", "Behcet");
INSERT INTO "Patient" VALUES ("2", "F", "Other");
INSERT INTO "Patient" VALUES ("3", "F", "Behcet");
INSERT INTO "Patient" VALUES ("4", "M", "Behcet");
INSERT INTO "Patient" VALUES ("5", "F", "Other");
INSERT INTO "Patient" VALUES ("6", "M", "Behcet");
INSERT INTO "Patient" VALUES ("7", "F", "Behcet");
INSERT INTO "Examination" VALUES ("1", "1997-01-15", "Behcet");
INSERT INTO "Examination" VALUES ("1", "1996-12-31", "Behcet");
INSERT INTO "Examination" VALUES ("2", "1997-06-10", "Other");
INSERT INTO "Examination" VALUES ("3", "1997-11-20", "Behcet");
INSERT INTO "Examination" VALUES ("3", "1998-01-01", "Behcet");
INSERT INTO "Examination" VALUES ("4", "1997-05-05", "Behcet");
INSERT INTO "Examination" VALUES ("4", "1997-12-31", "Other");
INSERT INTO "Examination" VALUES ("5", "1997-07-07", "Other");
INSERT INTO "Examination" VALUES ("6", "1996-11-11", "Behcet");
INSERT INTO "Examination" VALUES ("6", "1997-08-08", "Behcet");
INSERT INTO "Examination" VALUES ("7", "1997-12-30", "Behcet");
INSERT INTO "Examination" VALUES ("7", "1999-01-01", "Behcet");
INSERT INTO "Laboratory" VALUES ("1", "1997-01-15", "5.0");
INSERT INTO "Laboratory" VALUES ("1", "1996-12-31", "3.2");
INSERT INTO "Laboratory" VALUES ("3", "1997-11-20", "4.1");
INSERT INTO "Laboratory" VALUES ("4", "1997-05-05", "6.3");
INSERT INTO "Laboratory" VALUES ("6", "1997-08-08", "2.9");
INSERT INTO "Laboratory" VALUES ("7", "1997-12-30", "7.0");