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,
"UA" FLOAT,
"U-PRO" TEXT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Patient" VALUES ("1");
INSERT INTO "Patient" VALUES ("2");
INSERT INTO "Patient" VALUES ("3");
INSERT INTO "Patient" VALUES ("4");
INSERT INTO "Patient" VALUES ("5");
INSERT INTO "Patient" VALUES ("6");
INSERT INTO "Patient" VALUES ("7");
INSERT INTO "Patient" VALUES ("8");
INSERT INTO "Patient" VALUES ("9");
INSERT INTO "Patient" VALUES ("10");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "5.0", "15.0");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "7.0", "20.0");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-01", "6.0", "10.0");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-05", "8.0", "35.0");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-10", "6.5", "25.0");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-01", "6.2", "5.0");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-10", "7.5", "18.0");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-01", "5.5", "22.0");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-15", "9.0", "12.0");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-01", "6.8", "28.0");
INSERT INTO "Laboratory" VALUES ("9", "2023-09-10", "6.0", "32.0");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-01", "5.8", "10.0");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-05", "7.0", "29.0");
INSERT INTO "Examination" VALUES ("2023-01-10", "Normal", "None");
INSERT INTO "Examination" VALUES ("2023-02-01", "Normal", "Fatigue");
INSERT INTO "Examination" VALUES ("2023-03-10", "Normal", "None");
INSERT INTO "Examination" VALUES ("2023-04-01", "Normal", "None");
INSERT INTO "Examination" VALUES ("2023-05-10", "Normal", "Headache");
INSERT INTO "Examination" VALUES ("2023-06-01", "Normal", "None");
INSERT INTO "Examination" VALUES ("2023-07-15", "High UA", "Joint Pain");
INSERT INTO "Examination" VALUES ("2023-08-01", "Normal", "None");
INSERT INTO "Examination" VALUES ("2023-09-10", "High U-PRO", "Swelling");
INSERT INTO "Examination" VALUES ("2023-10-01", "Normal", "None");