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" (
"Examination Date" DATE,
"Diagnosis" TEXT,
"Symptoms" TEXT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"U-PRO" TEXT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Examination" VALUES ("2023-01-15", "SLE", "Fatigue, Joint Pain");
INSERT INTO "Examination" VALUES ("2023-02-20", "Flu", "Cough, Fever");
INSERT INTO "Examination" VALUES ("2023-03-10", "SLE", "Rash, Kidney Issues");
INSERT INTO "Examination" VALUES ("2023-04-05", "Hypertension", "Headache");
INSERT INTO "Examination" VALUES ("2023-05-12", "SLE", "Fatigue");
INSERT INTO "Examination" VALUES ("2023-06-01", "Arthritis", "Joint Swelling");
INSERT INTO "Examination" VALUES ("2023-07-19", "SLE", "Hair Loss");
INSERT INTO "Examination" VALUES ("2023-08-25", "Diabetes", "Increased Thirst");
INSERT INTO "Examination" VALUES ("2023-09-30", "SLE", "Chest Pain");
INSERT INTO "Examination" VALUES ("2023-10-10", "Common Cold", "Runny Nose");
INSERT INTO "Patient" VALUES ("1", "SLE");
INSERT INTO "Patient" VALUES ("2", "Flu");
INSERT INTO "Patient" VALUES ("3", "SLE");
INSERT INTO "Patient" VALUES ("4", "Hypertension");
INSERT INTO "Patient" VALUES ("5", "SLE");
INSERT INTO "Patient" VALUES ("6", "Arthritis");
INSERT INTO "Patient" VALUES ("7", "SLE");
INSERT INTO "Patient" VALUES ("8", "Diabetes");
INSERT INTO "Patient" VALUES ("9", "SLE");
INSERT INTO "Patient" VALUES ("10", "Common Cold");
INSERT INTO "Patient" VALUES ("11", "SLE");
INSERT INTO "Patient" VALUES ("12", "SLE");
INSERT INTO "Patient" VALUES ("13", "SLE");
INSERT INTO "Patient" VALUES ("14", "SLE");
INSERT INTO "Patient" VALUES ("15", "SLE");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-16", "15");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-21", "50");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-11", "25");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-06", "10");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-13", "5");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-02", "35");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-20", "20");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-26", "60");
INSERT INTO "Laboratory" VALUES ("9", "2023-09-01", "100");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-11", "12");
INSERT INTO "Laboratory" VALUES ("11", "2023-11-01", "28");
INSERT INTO "Laboratory" VALUES ("12", "2023-11-05", "2");
INSERT INTO "Laboratory" VALUES ("13", "2023-11-10", "30");
INSERT INTO "Laboratory" VALUES ("14", "2023-11-15", "0");
INSERT INTO "Laboratory" VALUES ("15", "2023-11-20", "29");