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 IgG" FLOAT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"LDH" INT,
"CRP" TEXT,
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", "Thrombosis");
INSERT INTO "Patient" VALUES ("2", "F", "1992-11-23", "Healthy");
INSERT INTO "Patient" VALUES ("3", "M", "1975-07-30", "Thrombosis");
INSERT INTO "Patient" VALUES ("4", "F", "1988-02-14", "At Risk");
INSERT INTO "Patient" VALUES ("5", "M", "2000-12-01", "Healthy");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "480", "Normal");
INSERT INTO "Laboratory" VALUES ("1", "2023-02-15", "510", "Elevated");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-12", "300", "Normal");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-05", "700", "High");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-20", "499", "Normal");
INSERT INTO "Laboratory" VALUES ("5", "2023-02-25", "501", "Elevated");
INSERT INTO "Laboratory" VALUES ("5", "2023-03-10", "480", "Normal");
INSERT INTO "Examination" VALUES ("12.5");
INSERT INTO "Examination" VALUES ("8.3");
INSERT INTO "Examination" VALUES ("15.0");
INSERT INTO "Examination" VALUES ("7.8");
INSERT INTO "Examination" VALUES ("10.1");