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,
"RBC" FLOAT,
"HGB" FLOAT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Patient" VALUES ("1", "F", "1960-05-20", "+", "Hypertension");
INSERT INTO "Patient" VALUES ("2", "F", "1975-11-15", "-", "Diabetes");
INSERT INTO "Patient" VALUES ("3", "M", "1955-07-30", "+", "Asthma");
INSERT INTO "Patient" VALUES ("4", "F", "1968-01-10", "+", "Anemia");
INSERT INTO "Patient" VALUES ("5", "F", "1940-03-25", "-", "Heart Disease");
INSERT INTO "Patient" VALUES ("6", "F", "1950-12-05", "+", "Thrombosis");
INSERT INTO "Patient" VALUES ("7", "F", "1969-08-22", "-", "Healthy");
INSERT INTO "Patient" VALUES ("8", "M", "1945-09-17", "-", "Diabetes");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "3.4", "13.5");
INSERT INTO "Laboratory" VALUES ("1", "2024-02-15", "3.6", "14.0");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-12", "4.0", "12.0");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-20", "6.1", "15.0");
INSERT INTO "Laboratory" VALUES ("4", "2024-03-05", "3.3", "11.5");
INSERT INTO "Laboratory" VALUES ("5", "2024-02-25", "6.5", "14.2");
INSERT INTO "Laboratory" VALUES ("6", "2024-01-30", "3.0", "13.0");
INSERT INTO "Laboratory" VALUES ("7", "2024-02-10", "3.7", "12.5");
INSERT INTO "Laboratory" VALUES ("8", "2024-01-15", "5.0", "14.0");
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");
INSERT INTO "Examination" VALUES ("1");