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

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"IGG" INT,
"IGA" INT,
"IGM" INT,
PRIMARY KEY ("ID", "Date")
);

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"Birthday" DATE,
"Admission" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "1960-05-20", "+");
INSERT INTO "Patient" VALUES ("2", "1975-11-15", "+");
INSERT INTO "Patient" VALUES ("3", "1950-01-10", "+");
INSERT INTO "Patient" VALUES ("4", "1945-07-30", "-");
INSERT INTO "Patient" VALUES ("5", "1968-03-25", "+");
INSERT INTO "Patient" VALUES ("6", "1955-12-05", "+");
INSERT INTO "Patient" VALUES ("7", "1980-08-14", "+");
INSERT INTO "Patient" VALUES ("8", "1940-09-09", "+");
INSERT INTO "Patient" VALUES ("9", "1935-02-28", "-");
INSERT INTO "Patient" VALUES ("10", "1962-06-17", "+");
INSERT INTO "Examination" VALUES ("1", "12.5");
INSERT INTO "Examination" VALUES ("2", "7.8");
INSERT INTO "Examination" VALUES ("3", "15.0");
INSERT INTO "Examination" VALUES ("4", "9.1");
INSERT INTO "Examination" VALUES ("5", "8.3");
INSERT INTO "Examination" VALUES ("6", "14.7");
INSERT INTO "Examination" VALUES ("7", "6.0");
INSERT INTO "Examination" VALUES ("8", "20.2");
INSERT INTO "Examination" VALUES ("9", "5.5");
INSERT INTO "Examination" VALUES ("10", "11.0");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "120", "80", "60");
INSERT INTO "Laboratory" VALUES ("1", "2024-02-15", "130", "85", "65");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-12", "110", "75", "55");
INSERT INTO "Laboratory" VALUES ("3", "2024-03-20", "140", "90", "70");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-25", "100", "70", "50");
INSERT INTO "Laboratory" VALUES ("5", "2024-02-05", "115", "78", "58");
INSERT INTO "Laboratory" VALUES ("6", "2024-03-15", "125", "82", "62");
INSERT INTO "Laboratory" VALUES ("7", "2024-01-30", "105", "72", "52");
INSERT INTO "Laboratory" VALUES ("8", "2024-02-20", "135", "88", "68");
INSERT INTO "Laboratory" VALUES ("9", "2024-03-10", "95", "68", "48");
INSERT INTO "Laboratory" VALUES ("10", "2024-01-18", "118", "79", "59");