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 "Laboratory" (
"ID" INT,
"Date" DATE,
"WBC" FLOAT,
"HGB" 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 "Patient" VALUES ("1", "F", "1990-05-10");
INSERT INTO "Patient" VALUES ("2", "M", "1985-11-22");
INSERT INTO "Patient" VALUES ("3", "F", "1978-03-15");
INSERT INTO "Patient" VALUES ("4", "F", "1995-08-01");
INSERT INTO "Patient" VALUES ("5", "M", "1970-01-30");
INSERT INTO "Patient" VALUES ("6", "F", "1982-06-25");
INSERT INTO "Patient" VALUES ("7", "M", "1998-04-12");
INSERT INTO "Patient" VALUES ("8", "F", "1965-09-03");
INSERT INTO "Patient" VALUES ("9", "M", "1993-12-18");
INSERT INTO "Patient" VALUES ("10", "F", "1988-07-07");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-01", "3.2", "14.5");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-05", "4.0", "14.0");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-02", "5.5", "15.0");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-03", "3.0", "13.8");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-07", "3.6", "13.5");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-04", "3.4", "12.9");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-08", "3.1", "13.0");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-05", "6.0", "16.0");
INSERT INTO "Laboratory" VALUES ("6", "2023-01-06", "3.3", "14.2");
INSERT INTO "Laboratory" VALUES ("6", "2023-01-09", "3.7", "14.0");
INSERT INTO "Laboratory" VALUES ("7", "2023-01-07", "5.0", "15.5");
INSERT INTO "Laboratory" VALUES ("8", "2023-01-08", "3.2", "13.1");
INSERT INTO "Laboratory" VALUES ("9", "2023-01-09", "4.8", "15.8");
INSERT INTO "Laboratory" VALUES ("10", "2023-01-10", "3.0", "13.3");
INSERT INTO "Laboratory" VALUES ("10", "2023-01-11", "3.5", "13.2");