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

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



INSERT INTO "Patient" VALUES ("1", "M", "1980-05-20", "Thrombosis");
INSERT INTO "Patient" VALUES ("2", "F", "1995-11-15", "Healthy");
INSERT INTO "Patient" VALUES ("3", "M", "1970-01-30", "Thrombosis");
INSERT INTO "Patient" VALUES ("4", "F", "2000-07-10", "Healthy");
INSERT INTO "Patient" VALUES ("5", "M", "1985-03-05", "Thrombosis");
INSERT INTO "Patient" VALUES ("6", "F", "1990-12-25", "Healthy");
INSERT INTO "Patient" VALUES ("7", "M", "2002-09-17", "Thrombosis");
INSERT INTO "Patient" VALUES ("8", "F", "1965-04-22", "Healthy");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "4.0", "13.5");
INSERT INTO "Laboratory" VALUES ("1", "2023-06-15", "9.5", "14.0");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-20", "3.0", "12.0");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-05", "8.5", "15.0");
INSERT INTO "Laboratory" VALUES ("3", "2023-07-10", "9.0", "14.5");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-12", "3.5", "13.0");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-18", "10.0", "14.2");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-22", "5.0", "13.8");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-30", "2.5", "12.5");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-15", "9.2", "13.9");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");