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,
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", "1950-05-20");
INSERT INTO "Patient" VALUES ("2", "F", "1980-11-15");
INSERT INTO "Patient" VALUES ("3", "M", "1975-07-30");
INSERT INTO "Patient" VALUES ("4", "F", "2000-01-10");
INSERT INTO "Patient" VALUES ("5", "M", "1965-03-05");
INSERT INTO "Patient" VALUES ("6", "F", "1995-12-25");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "180", "210");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-11", "190", "199");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-12", "200", "250");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-13", "170", "200");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-14", "160", "180");
INSERT INTO "Laboratory" VALUES ("6", "2023-01-15", "210", "220");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-01", "195", "205");
INSERT INTO "Laboratory" VALUES ("3", "2023-02-02", "185", "180");
INSERT INTO "Laboratory" VALUES ("4", "2023-02-03", "175", "199");
INSERT INTO "Laboratory" VALUES ("1", "2023-02-04", "165", "230");