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,
"Symptoms" TEXT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
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", "SLE");
INSERT INTO "Patient" VALUES ("3", "F", "APS");
INSERT INTO "Patient" VALUES ("4", "F", "RA");
INSERT INTO "Patient" VALUES ("5", "M", "APS");
INSERT INTO "Patient" VALUES ("6", "F", "APS");
INSERT INTO "Patient" VALUES ("7", "F", "SLE");
INSERT INTO "Patient" VALUES ("8", "M", "RA");
INSERT INTO "Patient" VALUES ("9", "F", "APS");
INSERT INTO "Patient" VALUES ("10", "M", "APS");
INSERT INTO "Examination" VALUES ("1", "2023-01-15", "APS", "Fatigue");
INSERT INTO "Examination" VALUES ("2", "2023-02-01", "SLE", "Joint Pain");
INSERT INTO "Examination" VALUES ("3", "2023-03-10", "APS", "Headaches");
INSERT INTO "Examination" VALUES ("4", "2023-04-05", "RA", "Swelling");
INSERT INTO "Examination" VALUES ("5", "2023-05-20", "APS", "Dizziness");
INSERT INTO "Examination" VALUES ("6", "2023-06-12", "APS", "Fatigue");
INSERT INTO "Examination" VALUES ("7", "2023-07-01", "SLE", "Rash");
INSERT INTO "Examination" VALUES ("8", "2023-08-18", "RA", "Stiffness");
INSERT INTO "Examination" VALUES ("9", "2023-09-25", "APS", "Vision problems");
INSERT INTO "Examination" VALUES ("10", "2023-10-30", "APS", "Shortness of breath");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-25");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-05");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-01");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-15");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-08");
INSERT INTO "Laboratory" VALUES ("7", "2023-06-28");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-15");
INSERT INTO "Laboratory" VALUES ("9", "2023-09-20");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-25");