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,
"Birthday" DATE,
"Admission" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Examination" VALUES ("Normal");
INSERT INTO "Examination" VALUES ("Abnormal");
INSERT INTO "Examination" VALUES ("Pending");
INSERT INTO "Examination" VALUES ("Critical");
INSERT INTO "Examination" VALUES ("Stable");
INSERT INTO "Patient" VALUES ("1", "F", "1970-05-10", "+");
INSERT INTO "Patient" VALUES ("2", "M", "1985-11-20", "-");
INSERT INTO "Patient" VALUES ("3", "F", "1965-03-15", "+");
INSERT INTO "Patient" VALUES ("4", "F", "1990-07-01", "-");
INSERT INTO "Patient" VALUES ("5", "M", "1950-01-01", "+");
INSERT INTO "Patient" VALUES ("6", "F", "1972-09-25", "-");
INSERT INTO "Patient" VALUES ("7", "F", "1960-02-29", "+");
INSERT INTO "Patient" VALUES ("8", "M", "1975-04-12", "-");
INSERT INTO "Patient" VALUES ("9", "F", "1955-08-18", "+");
INSERT INTO "Patient" VALUES ("10", "F", "1980-12-05", "-");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "3.2", "11.5", "35.0");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "5.0", "14.0", "42.0");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-10", "4.5", "13.0", "40.0");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-10", "6.1", "16.0", "48.0");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-12", "3.0", "10.0", "30.0");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-10", "4.0", "12.5", "38.0");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-10", "5.5", "15.0", "45.0");
INSERT INTO "Laboratory" VALUES ("6", "2023-01-10", "3.4", "11.0", "33.0");
INSERT INTO "Laboratory" VALUES ("7", "2023-01-10", "6.2", "16.5", "49.0");
INSERT INTO "Laboratory" VALUES ("7", "2023-01-11", "3.1", "10.5", "32.0");
INSERT INTO "Laboratory" VALUES ("8", "2023-01-10", "4.8", "13.5", "41.0");
INSERT INTO "Laboratory" VALUES ("9", "2023-01-10", "3.3", "10.8", "34.0");
INSERT INTO "Laboratory" VALUES ("9", "2023-01-13", "6.0", "15.8", "47.0");
INSERT INTO "Laboratory" VALUES ("10", "2023-01-10", "4.2", "12.0", "37.0");