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 "Patient" VALUES ("9", "F");
INSERT INTO "Patient" VALUES ("10", "F");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "6.2", "Normal");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-16", "7.1", "Abnormal");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-17", "6.8", "Normal");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-18", "5.5", "Normal");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-19", "6.9", "Normal");
INSERT INTO "Laboratory" VALUES ("6", "2023-01-20", "6.8", "Normal");
INSERT INTO "Laboratory" VALUES ("7", "2023-01-21", "7.5", "Abnormal");
INSERT INTO "Laboratory" VALUES ("8", "2023-01-22", "6.8", "Normal");
INSERT INTO "Laboratory" VALUES ("9", "2023-01-23", "6.7", "Normal");
INSERT INTO "Laboratory" VALUES ("10", "2023-01-24", "6.6", "Normal");
INSERT INTO "Examination" VALUES ("1", "15.2", "8.1", "100", "5", "Thrombosis");
INSERT INTO "Examination" VALUES ("2", "10.5", "6.3", "200", "3", "No Thrombosis");
INSERT INTO "Examination" VALUES ("3", "18.0", "9.5", "150", "7", "Thrombosis");
INSERT INTO "Examination" VALUES ("4", "12.1", "7.0", "120", "4", "No Thrombosis");
INSERT INTO "Examination" VALUES ("5", "20.1", "10.2", "180", "8", "Thrombosis");
INSERT INTO "Examination" VALUES ("6", "19.5", "9.8", "170", "7", "Thrombosis");
INSERT INTO "Examination" VALUES ("7", "11.0", "6.5", "210", "3", "No Thrombosis");
INSERT INTO "Examination" VALUES ("8", "18.2", "9.6", "160", "6", "Thrombosis");
INSERT INTO "Examination" VALUES ("9", "17.8", "9.3", "155", "6", "Thrombosis");
INSERT INTO "Examination" VALUES ("10", "17.5", "9.0", "152", "5", "Thrombosis");