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" (
"Diagnosis" TEXT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"RBC" FLOAT,
"HGB" FLOAT,
"HCT" FLOAT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Patient" VALUES ("1", "M", "-");
INSERT INTO "Patient" VALUES ("2", "F", "-");
INSERT INTO "Patient" VALUES ("3", "M", "2023-01-10");
INSERT INTO "Patient" VALUES ("4", "F", "-");
INSERT INTO "Patient" VALUES ("5", "M", "2023-02-15");
INSERT INTO "Patient" VALUES ("6", "F", "-");
INSERT INTO "Patient" VALUES ("7", "M", "-");
INSERT INTO "Patient" VALUES ("8", "F", "2023-03-20");
INSERT INTO "Laboratory" VALUES ("1", "2024-05-01", "4.5", "9.8", "28.0");
INSERT INTO "Laboratory" VALUES ("2", "2024-05-02", "4.7", "10.5", "30.0");
INSERT INTO "Laboratory" VALUES ("3", "2024-05-03", "4.6", "11.0", "32.0");
INSERT INTO "Laboratory" VALUES ("4", "2024-05-04", "4.2", "9.5", "27.0");
INSERT INTO "Laboratory" VALUES ("5", "2024-05-05", "4.8", "12.0", "35.0");
INSERT INTO "Laboratory" VALUES ("6", "2024-05-06", "4.3", "8.9", "26.0");
INSERT INTO "Laboratory" VALUES ("7", "2024-05-07", "4.4", "9.9", "29.0");
INSERT INTO "Laboratory" VALUES ("8", "2024-05-08", "4.9", "13.0", "36.0");