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" (
"aCL IgA" INT
);

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



INSERT INTO "Patient" VALUES ("1", "M", "1980-05-12", "Deep Vein Thrombosis");
INSERT INTO "Patient" VALUES ("2", "F", "1975-11-23", "Pulmonary Embolism");
INSERT INTO "Patient" VALUES ("3", "M", "1990-07-30", "No Thrombosis");
INSERT INTO "Patient" VALUES ("4", "F", "1985-02-14", "Chronic Thrombophlebitis");
INSERT INTO "Patient" VALUES ("5", "M", "2000-12-01", "Acute Thrombosis");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "120", "85", "60");
INSERT INTO "Laboratory" VALUES ("1", "2023-06-15", "130", "90", "70");
INSERT INTO "Laboratory" VALUES ("2", "2023-03-20", "110", "500", "65");
INSERT INTO "Laboratory" VALUES ("2", "2023-07-25", "115", "480", "68");
INSERT INTO "Laboratory" VALUES ("3", "2023-04-05", "100", "79", "55");
INSERT INTO "Laboratory" VALUES ("3", "2023-08-10", "105", "81", "58");
INSERT INTO "Laboratory" VALUES ("4", "2023-02-28", "140", "300", "75");
INSERT INTO "Laboratory" VALUES ("4", "2023-09-12", "135", "499", "72");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-18", "125", "501", "80");
INSERT INTO "Laboratory" VALUES ("5", "2023-10-20", "130", "450", "85");