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,
"T-CHO" INT,
"TG" INT,
"GLU" INT,
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 "Examination" VALUES ("Thrombosis");
INSERT INTO "Examination" VALUES ("No Thrombosis");
INSERT INTO "Examination" VALUES ("High Blood Pressure");
INSERT INTO "Examination" VALUES ("Diabetes");
INSERT INTO "Examination" VALUES ("Heart Disease");
INSERT INTO "Patient" VALUES ("1", "M", "1970-05-10");
INSERT INTO "Patient" VALUES ("2", "F", "1985-11-22");
INSERT INTO "Patient" VALUES ("3", "M", "1960-01-15");
INSERT INTO "Patient" VALUES ("4", "F", "1992-03-01");
INSERT INTO "Patient" VALUES ("5", "M", "1975-07-30");
INSERT INTO "Patient" VALUES ("6", "M", "1980-09-12");
INSERT INTO "Patient" VALUES ("7", "F", "1965-02-28");
INSERT INTO "Patient" VALUES ("8", "M", "1955-04-05");
INSERT INTO "Patient" VALUES ("9", "F", "1990-06-18");
INSERT INTO "Patient" VALUES ("10", "M", "1972-12-25");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-01", "260", "150", "100");
INSERT INTO "Laboratory" VALUES ("1", "2023-07-15", "240", "140", "95");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-05", "200", "120", "80");
INSERT INTO "Laboratory" VALUES ("3", "2023-02-10", "270", "180", "110");
INSERT INTO "Laboratory" VALUES ("3", "2023-08-20", "255", "170", "105");
INSERT INTO "Laboratory" VALUES ("4", "2023-03-01", "220", "130", "85");
INSERT INTO "Laboratory" VALUES ("5", "2023-04-01", "280", "200", "120");
INSERT INTO "Laboratory" VALUES ("6", "2023-05-01", "290", "210", "130");
INSERT INTO "Laboratory" VALUES ("7", "2023-06-01", "230", "145", "90");
INSERT INTO "Laboratory" VALUES ("8", "2023-07-01", "250", "160", "100");
INSERT INTO "Laboratory" VALUES ("9", "2023-08-01", "210", "125", "75");
INSERT INTO "Laboratory" VALUES ("10", "2023-09-01", "265", "175", "115");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-01", "245", "165", "110");