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
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"UN" INT,
"CRE" FLOAT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Examination" VALUES ("2023-01-15");
INSERT INTO "Examination" VALUES ("2023-02-20");
INSERT INTO "Examination" VALUES ("2023-03-10");
INSERT INTO "Examination" VALUES ("2023-04-05");
INSERT INTO "Examination" VALUES ("2023-05-12");
INSERT INTO "Examination" VALUES ("2023-06-01");
INSERT INTO "Examination" VALUES ("2023-07-22");
INSERT INTO "Examination" VALUES ("2023-08-18");
INSERT INTO "Examination" VALUES ("2023-09-03");
INSERT INTO "Examination" VALUES ("2023-10-25");
INSERT INTO "Patient" VALUES ("1", "M", "1980-05-10");
INSERT INTO "Patient" VALUES ("2", "F", "1975-11-22");
INSERT INTO "Patient" VALUES ("3", "M", "1990-03-15");
INSERT INTO "Patient" VALUES ("4", "F", "1988-07-01");
INSERT INTO "Patient" VALUES ("5", "M", "1965-09-30");
INSERT INTO "Patient" VALUES ("6", "F", "1992-01-08");
INSERT INTO "Patient" VALUES ("7", "M", "1970-04-25");
INSERT INTO "Patient" VALUES ("8", "F", "1983-12-14");
INSERT INTO "Patient" VALUES ("9", "M", "1955-06-19");
INSERT INTO "Patient" VALUES ("10", "F", "1995-02-28");
INSERT INTO "Patient" VALUES ("11", "M", "1982-08-01");
INSERT INTO "Patient" VALUES ("12", "F", "1978-03-17");
INSERT INTO "Patient" VALUES ("13", "M", "1960-10-05");
INSERT INTO "Patient" VALUES ("14", "F", "1998-04-11");
INSERT INTO "Patient" VALUES ("15", "M", "1973-01-20");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "15", "1.2");
INSERT INTO "Laboratory" VALUES ("1", "2023-02-15", "20", "1.6");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-15", "12", "0.9");
INSERT INTO "Laboratory" VALUES ("2", "2023-03-10", "18", "1.7");
INSERT INTO "Laboratory" VALUES ("3", "2023-02-20", "25", "1.8");
INSERT INTO "Laboratory" VALUES ("3", "2023-04-05", "22", "1.5");
INSERT INTO "Laboratory" VALUES ("4", "2023-03-10", "10", "0.8");
INSERT INTO "Laboratory" VALUES ("4", "2023-05-12", "14", "1.1");
INSERT INTO "Laboratory" VALUES ("5", "2023-04-05", "30", "2.0");
INSERT INTO "Laboratory" VALUES ("5", "2023-06-01", "28", "1.9");
INSERT INTO "Laboratory" VALUES ("6", "2023-05-12", "11", "0.7");
INSERT INTO "Laboratory" VALUES ("6", "2023-07-22", "13", "1.0");
INSERT INTO "Laboratory" VALUES ("7", "2023-06-01", "28", "1.7");
INSERT INTO "Laboratory" VALUES ("7", "2023-08-18", "26", "1.6");
INSERT INTO "Laboratory" VALUES ("8", "2023-07-22", "16", "1.3");
INSERT INTO "Laboratory" VALUES ("8", "2023-09-03", "19", "1.5");
INSERT INTO "Laboratory" VALUES ("9", "2023-08-18", "35", "2.5");
INSERT INTO "Laboratory" VALUES ("9", "2023-10-25", "32", "2.3");
INSERT INTO "Laboratory" VALUES ("10", "2023-09-03", "14", "1.0");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-25", "17", "1.4");
INSERT INTO "Laboratory" VALUES ("11", "2023-01-15", "21", "1.6");
INSERT INTO "Laboratory" VALUES ("12", "2023-02-20", "19", "1.5");
INSERT INTO "Laboratory" VALUES ("13", "2023-03-10", "27", "1.8");
INSERT INTO "Laboratory" VALUES ("14", "2023-04-05", "15", "1.2");
INSERT INTO "Laboratory" VALUES ("15", "2023-05-12", "31", "2.1");