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 "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 "Patient" VALUES ("1", "M", "1937-01-15");
INSERT INTO "Patient" VALUES ("2", "F", "1937-06-30");
INSERT INTO "Patient" VALUES ("3", "M", "1937-12-05");
INSERT INTO "Patient" VALUES ("4", "F", "1940-03-22");
INSERT INTO "Patient" VALUES ("5", "M", "1936-11-11");
INSERT INTO "Patient" VALUES ("6", "F", "1937-07-19");
INSERT INTO "Patient" VALUES ("7", "M", "1950-08-08");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "260", "150", "90");
INSERT INTO "Laboratory" VALUES ("1", "2023-06-15", "245", "140", "85");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-20", "251", "160", "95");
INSERT INTO "Laboratory" VALUES ("2", "2023-07-25", "249", "155", "92");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-05", "300", "170", "100");
INSERT INTO "Laboratory" VALUES ("3", "2023-08-10", "280", "165", "98");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-12", "240", "130", "88");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-18", "255", "145", "91");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-22", "249", "135", "89");
INSERT INTO "Laboratory" VALUES ("6", "2023-09-30", "260", "140", "90");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-01", "270", "150", "93");