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,
"Examination Date" DATE,
"Diagnosis" TEXT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"CRP" TEXT,
PRIMARY KEY ("ID", "Date")
);

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



INSERT INTO "Patient" VALUES ("1", "F", "APS");
INSERT INTO "Patient" VALUES ("2", "M", "APS");
INSERT INTO "Patient" VALUES ("3", "F", "None");
INSERT INTO "Patient" VALUES ("4", "F", "APS");
INSERT INTO "Patient" VALUES ("5", "M", "None");
INSERT INTO "Patient" VALUES ("6", "F", "Other");
INSERT INTO "Patient" VALUES ("7", "F", "APS");
INSERT INTO "Patient" VALUES ("8", "M", "APS");
INSERT INTO "Patient" VALUES ("9", "F", "None");
INSERT INTO "Patient" VALUES ("10", "F", "APS");
INSERT INTO "Examination" VALUES ("1", "2023-01-15", "APS");
INSERT INTO "Examination" VALUES ("1", "2023-03-10", "None");
INSERT INTO "Examination" VALUES ("2", "2023-02-20", "APS");
INSERT INTO "Examination" VALUES ("3", "2023-01-25", "None");
INSERT INTO "Examination" VALUES ("4", "2023-04-05", "APS");
INSERT INTO "Examination" VALUES ("5", "2023-03-15", "None");
INSERT INTO "Examination" VALUES ("6", "2023-02-28", "Other");
INSERT INTO "Examination" VALUES ("7", "2023-01-30", "APS");
INSERT INTO "Examination" VALUES ("8", "2023-03-22", "APS");
INSERT INTO "Examination" VALUES ("9", "2023-04-10", "None");
INSERT INTO "Examination" VALUES ("10", "2023-02-05", "APS");
INSERT INTO "Examination" VALUES ("10", "2023-05-01", "None");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "5.2");
INSERT INTO "Laboratory" VALUES ("1", "2023-03-10", "3.1");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-20", "4.8");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-25", "2.0");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-05", "6.0");
INSERT INTO "Laboratory" VALUES ("5", "2023-03-15", "1.5");
INSERT INTO "Laboratory" VALUES ("6", "2023-02-28", "3.3");
INSERT INTO "Laboratory" VALUES ("7", "2023-01-30", "5.5");
INSERT INTO "Laboratory" VALUES ("8", "2023-03-22", "4.9");
INSERT INTO "Laboratory" VALUES ("9", "2023-04-10", "2.2");
INSERT INTO "Laboratory" VALUES ("10", "2023-02-05", "5.0");
INSERT INTO "Laboratory" VALUES ("10", "2023-05-01", "3.0");