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

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"UA" FLOAT,
"DNA" TEXT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Patient" VALUES ("1", "F");
INSERT INTO "Patient" VALUES ("2", "M");
INSERT INTO "Patient" VALUES ("3", "F");
INSERT INTO "Patient" VALUES ("4", "M");
INSERT INTO "Patient" VALUES ("5", "F");
INSERT INTO "Patient" VALUES ("6", "F");
INSERT INTO "Patient" VALUES ("7", "M");
INSERT INTO "Patient" VALUES ("8", "F");
INSERT INTO "Examination" VALUES ("1", "15.2", "8.1", "1", "5.0", "Normal");
INSERT INTO "Examination" VALUES ("2", "20.5", "12.3", "2", "7.2", "Thrombosis");
INSERT INTO "Examination" VALUES ("3", "18.0", "9.5", "1", "6.1", "Normal");
INSERT INTO "Examination" VALUES ("4", "10.1", "5.0", "0", "3.5", "Normal");
INSERT INTO "Examination" VALUES ("5", "25.3", "15.0", "3", "9.8", "Thrombosis");
INSERT INTO "Examination" VALUES ("6", "16.8", "7.9", "1", "4.5", "Normal");
INSERT INTO "Examination" VALUES ("7", "12.0", "6.0", "0", "3.0", "Normal");
INSERT INTO "Examination" VALUES ("8", "19.5", "10.2", "2", "6.5", "Thrombosis");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "5.8", "Normal");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-11", "7.0", "Abnormal");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-12", "6.4", "Normal");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-13", "4.5", "Normal");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-14", "8.2", "Abnormal");
INSERT INTO "Laboratory" VALUES ("6", "2023-01-15", "6.5", "Normal");
INSERT INTO "Laboratory" VALUES ("7", "2023-01-16", "5.0", "Normal");
INSERT INTO "Laboratory" VALUES ("8", "2023-01-17", "6.8", "Abnormal");