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" (
"Thrombosis" INT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"HGB" FLOAT,
"HCT" 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", "1960-05-20");
INSERT INTO "Patient" VALUES ("2", "F", "1985-11-15");
INSERT INTO "Patient" VALUES ("3", "M", "1975-07-30");
INSERT INTO "Patient" VALUES ("4", "F", "1990-01-10");
INSERT INTO "Patient" VALUES ("5", "M", "2000-12-05");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "14.5", "53.0");
INSERT INTO "Laboratory" VALUES ("1", "2023-02-15", "15.0", "54.5");
INSERT INTO "Laboratory" VALUES ("1", "2023-03-20", "14.8", "51.0");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-12", "13.0", "50.0");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-18", "13.5", "49.5");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-20", "16.0", "52.0");
INSERT INTO "Laboratory" VALUES ("3", "2023-02-25", "15.8", "53.5");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-30", "16.2", "54.0");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-22", "12.5", "48.0");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-25", "14.0", "52.5");
INSERT INTO "Laboratory" VALUES ("5", "2023-02-28", "14.2", "51.5");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");