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

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

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



INSERT INTO "Patient" VALUES ("1", "1994-02-19", "SLE");
INSERT INTO "Patient" VALUES ("2", "1995-05-10", "Other");
INSERT INTO "Patient" VALUES ("3", "1994-02-19", "SLE");
INSERT INTO "Patient" VALUES ("4", "1993-12-01", "SLE");
INSERT INTO "Examination" VALUES ("1", "1993-11-12", "12.5");
INSERT INTO "Examination" VALUES ("1", "1994-01-15", "8.0");
INSERT INTO "Examination" VALUES ("2", "1993-11-12", "5.0");
INSERT INTO "Examination" VALUES ("3", "1993-11-12", "0.0");
INSERT INTO "Examination" VALUES ("3", "1993-10-10", "3.3");
INSERT INTO "Examination" VALUES ("4", "1993-11-12", "7.7");
INSERT INTO "Laboratory" VALUES ("1", "1993-11-12", "150");
INSERT INTO "Laboratory" VALUES ("1", "1994-01-15", "140");
INSERT INTO "Laboratory" VALUES ("2", "1993-11-12", "130");
INSERT INTO "Laboratory" VALUES ("3", "1993-11-12", "120");
INSERT INTO "Laboratory" VALUES ("4", "1993-11-12", "110");