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 "Laboratory" (
"ID" INT,
"Date" DATE,
"IGG" INT,
"IGA" INT,
"IGM" INT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"SEX" TEXT,
"First Date" DATE,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "M", "1989-12-31");
INSERT INTO "Patient" VALUES ("2", "F", "1990-01-01");
INSERT INTO "Patient" VALUES ("3", "M", "1991-06-15");
INSERT INTO "Patient" VALUES ("4", "F", "1995-03-20");
INSERT INTO "Patient" VALUES ("5", "M", "1985-07-07");
INSERT INTO "Patient" VALUES ("6", "F", "1992-11-11");
INSERT INTO "Patient" VALUES ("7", "M", "1990-01-02");
INSERT INTO "Patient" VALUES ("8", "F", "1988-05-05");
INSERT INTO "Patient" VALUES ("9", "M", "1993-09-09");
INSERT INTO "Patient" VALUES ("10", "F", "1990-12-31");
INSERT INTO "Laboratory" VALUES ("1", "1990-02-01", "100", "90", "50");
INSERT INTO "Laboratory" VALUES ("1", "1991-03-01", "110", "70", "60");
INSERT INTO "Laboratory" VALUES ("2", "1990-01-02", "120", "81", "55");
INSERT INTO "Laboratory" VALUES ("3", "1991-07-01", "130", "499", "65");
INSERT INTO "Laboratory" VALUES ("4", "1995-04-01", "140", "500", "70");
INSERT INTO "Laboratory" VALUES ("5", "1985-08-01", "150", "100", "75");
INSERT INTO "Laboratory" VALUES ("6", "1992-12-01", "160", "79", "80");
INSERT INTO "Laboratory" VALUES ("7", "1990-01-03", "170", "300", "85");
INSERT INTO "Laboratory" VALUES ("8", "1988-06-01", "180", "200", "90");
INSERT INTO "Laboratory" VALUES ("9", "1993-10-01", "190", "81", "95");
INSERT INTO "Laboratory" VALUES ("10", "1991-01-01", "200", "499", "100");
INSERT INTO "Laboratory" VALUES ("10", "1991-06-01", "210", "79", "105");