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

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

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



INSERT INTO "Examination" VALUES ("2023-01-15", "Thrombosis");
INSERT INTO "Examination" VALUES ("2023-02-20", "Anemia");
INSERT INTO "Examination" VALUES ("2023-03-10", "Healthy");
INSERT INTO "Examination" VALUES ("2023-04-05", "Thrombosis");
INSERT INTO "Examination" VALUES ("2023-05-01", "Anemia");
INSERT INTO "Examination" VALUES ("2023-06-12", "Healthy");
INSERT INTO "Examination" VALUES ("2023-07-25", "Thrombosis");
INSERT INTO "Examination" VALUES ("2023-08-30", "Anemia");
INSERT INTO "Examination" VALUES ("2023-09-18", "Healthy");
INSERT INTO "Examination" VALUES ("2023-10-07", "Thrombosis");
INSERT INTO "Patient" VALUES ("1", "1980-05-10", "Thrombosis");
INSERT INTO "Patient" VALUES ("2", "1992-11-22", "Anemia");
INSERT INTO "Patient" VALUES ("3", "1975-03-15", "Healthy");
INSERT INTO "Patient" VALUES ("4", "2000-07-01", "Thrombosis");
INSERT INTO "Patient" VALUES ("5", "1965-09-30", "Anemia");
INSERT INTO "Patient" VALUES ("6", "1988-01-20", "Healthy");
INSERT INTO "Patient" VALUES ("7", "1995-04-12", "Thrombosis");
INSERT INTO "Patient" VALUES ("8", "1970-06-05", "Anemia");
INSERT INTO "Patient" VALUES ("9", "2005-02-28", "Healthy");
INSERT INTO "Patient" VALUES ("10", "1982-08-18", "Thrombosis");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15", "3.2", "10.5");
INSERT INTO "Laboratory" VALUES ("1", "2023-02-15", "3.6", "11.0");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-20", "3.0", "9.8");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-10", "4.5", "14.0");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-05", "3.1", "10.2");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-01", "2.8", "9.5");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-12", "4.2", "13.5");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-25", "3.3", "10.8");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-30", "2.9", "9.7");
INSERT INTO "Laboratory" VALUES ("9", "2023-09-18", "4.0", "13.0");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-07", "3.4", "10.9");
INSERT INTO "Laboratory" VALUES ("10", "2023-11-07", "3.8", "11.5");