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,
"UN" INT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Patient" VALUES ("1", "M", "1980-05-10", "RA");
INSERT INTO "Patient" VALUES ("2", "F", "1992-11-22", "Lupus");
INSERT INTO "Patient" VALUES ("3", "M", "1975-03-15", "RA");
INSERT INTO "Patient" VALUES ("4", "F", "1988-07-01", "Osteoarthritis");
INSERT INTO "Patient" VALUES ("5", "M", "1960-01-20", "RA");
INSERT INTO "Patient" VALUES ("6", "F", "1995-09-05", "RA");
INSERT INTO "Patient" VALUES ("7", "M", "1970-04-12", "Gout");
INSERT INTO "Patient" VALUES ("8", "F", "1983-06-30", "RA");
INSERT INTO "Patient" VALUES ("9", "M", "1990-02-18", "Fibromyalgia");
INSERT INTO "Patient" VALUES ("10", "F", "1965-12-25", "RA");
INSERT INTO "Examination" VALUES ("1", "2023-01-15", "RA", "Joint pain, swelling");
INSERT INTO "Examination" VALUES ("2", "2023-02-01", "Lupus", "Fatigue, rash");
INSERT INTO "Examination" VALUES ("3", "2023-01-20", "RA", "Morning stiffness");
INSERT INTO "Examination" VALUES ("4", "2023-03-10", "Osteoarthritis", "Knee pain");
INSERT INTO "Examination" VALUES ("5", "2023-01-25", "RA", "Symmetric polyarthritis");
INSERT INTO "Examination" VALUES ("6", "2023-02-10", "RA", "Hand deformities");
INSERT INTO "Examination" VALUES ("7", "2023-03-05", "Gout", "Big toe pain");
INSERT INTO "Examination" VALUES ("8", "2023-02-15", "RA", "Fatigue");
INSERT INTO "Examination" VALUES ("9", "2023-04-01", "Fibromyalgia", "Widespread pain");
INSERT INTO "Examination" VALUES ("10", "2023-02-20", "RA", "Nodules");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-16", "25");
INSERT INTO "Laboratory" VALUES ("1", "2023-03-01", "35");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-02", "28");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-21", "15");
INSERT INTO "Laboratory" VALUES ("3", "2023-04-05", "32");
INSERT INTO "Laboratory" VALUES ("4", "2023-03-11", "20");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-26", "29");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-10", "40");
INSERT INTO "Laboratory" VALUES ("6", "2023-02-11", "18");
INSERT INTO "Laboratory" VALUES ("7", "2023-03-06", "22");
INSERT INTO "Laboratory" VALUES ("8", "2023-02-16", "27");
INSERT INTO "Laboratory" VALUES ("8", "2023-06-15", "31");
INSERT INTO "Laboratory" VALUES ("9", "2023-04-02", "24");
INSERT INTO "Laboratory" VALUES ("10", "2023-02-21", "19");
INSERT INTO "Laboratory" VALUES ("10", "2023-07-20", "30");