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,
"WBC" FLOAT,
"RBC" 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", "M", "1980-05-10");
INSERT INTO "Patient" VALUES ("2", "F", "1992-11-22");
INSERT INTO "Patient" VALUES ("3", "M", "1975-03-15");
INSERT INTO "Patient" VALUES ("4", "F", "2000-01-01");
INSERT INTO "Patient" VALUES ("5", "M", "1965-07-30");
INSERT INTO "Patient" VALUES ("6", "F", "1988-09-05");
INSERT INTO "Patient" VALUES ("7", "M", "1995-02-28");
INSERT INTO "Patient" VALUES ("8", "F", "1970-04-12");
INSERT INTO "Patient" VALUES ("9", "M", "1982-06-18");
INSERT INTO "Patient" VALUES ("10", "F", "1998-10-25");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "4.5", "5.0", "14.0");
INSERT INTO "Laboratory" VALUES ("1", "2023-02-01", "3.0", "4.8", "13.5");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-20", "9.5", "4.2", "12.0");
INSERT INTO "Laboratory" VALUES ("2", "2023-03-10", "8.0", "4.3", "12.5");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-25", "3.2", "5.5", "15.0");
INSERT INTO "Laboratory" VALUES ("4", "2023-02-05", "7.0", "4.0", "11.0");
INSERT INTO "Laboratory" VALUES ("5", "2023-02-10", "10.0", "5.1", "14.5");
INSERT INTO "Laboratory" VALUES ("6", "2023-02-15", "3.8", "4.6", "13.0");
INSERT INTO "Laboratory" VALUES ("7", "2023-02-20", "2.5", "5.2", "14.8");
INSERT INTO "Laboratory" VALUES ("8", "2023-02-25", "9.0", "4.4", "12.2");
INSERT INTO "Laboratory" VALUES ("9", "2023-03-01", "6.0", "5.3", "15.5");
INSERT INTO "Laboratory" VALUES ("10", "2023-03-05", "11.0", "4.1", "11.5");
INSERT INTO "Laboratory" VALUES ("1", "2023-03-15", "8.5", "4.9", "13.8");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-20", "9.2", "5.4", "15.2");
INSERT INTO "Laboratory" VALUES ("5", "2023-03-25", "3.4", "5.0", "14.3");
INSERT INTO "Laboratory" VALUES ("7", "2023-03-30", "9.8", "5.1", "14.9");
INSERT INTO "Laboratory" VALUES ("9", "2023-04-05", "3.1", "5.2", "15.1");
INSERT INTO "Examination" VALUES ("Normal");
INSERT INTO "Examination" VALUES ("Abnormal WBC");
INSERT INTO "Examination" VALUES ("Normal");
INSERT INTO "Examination" VALUES ("Abnormal WBC");
INSERT INTO "Examination" VALUES ("Normal");
INSERT INTO "Examination" VALUES ("Abnormal WBC");
INSERT INTO "Examination" VALUES ("Normal");
INSERT INTO "Examination" VALUES ("Abnormal WBC");
INSERT INTO "Examination" VALUES ("Normal");
INSERT INTO "Examination" VALUES ("Abnormal WBC");