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,
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", "1959-02-18");
INSERT INTO "Patient" VALUES ("2", "F", "1960-05-10");
INSERT INTO "Patient" VALUES ("3", "M", "1959-02-18");
INSERT INTO "Patient" VALUES ("4", "F", "1970-01-01");
INSERT INTO "Patient" VALUES ("5", "M", "1959-02-18");
INSERT INTO "Patient" VALUES ("6", "F", "1985-11-22");
INSERT INTO "Laboratory" VALUES ("1", "1981-11-05", "200", "150");
INSERT INTO "Laboratory" VALUES ("1", "1981-12-10", "180", "140");
INSERT INTO "Laboratory" VALUES ("1", "1982-01-15", "190", "145");
INSERT INTO "Laboratory" VALUES ("2", "1981-11-01", "210", "160");
INSERT INTO "Laboratory" VALUES ("2", "1981-12-01", "205", "155");
INSERT INTO "Laboratory" VALUES ("3", "1981-11-10", "220", "170");
INSERT INTO "Laboratory" VALUES ("3", "1981-12-05", "230", "175");
INSERT INTO "Laboratory" VALUES ("4", "1981-11-15", "195", "130");
INSERT INTO "Laboratory" VALUES ("5", "1981-11-20", "250", "180");
INSERT INTO "Laboratory" VALUES ("5", "1981-12-25", "210", "160");
INSERT INTO "Laboratory" VALUES ("5", "1981-12-01", "220", "165");
INSERT INTO "Laboratory" VALUES ("5", "1981-12-15", "200", "150");
INSERT INTO "Laboratory" VALUES ("6", "1981-11-01", "180", "120");
INSERT INTO "Examination" VALUES ("Normal");
INSERT INTO "Examination" VALUES ("High Cholesterol");
INSERT INTO "Examination" VALUES ("Thrombosis Risk");
INSERT INTO "Examination" VALUES ("Normal");
INSERT INTO "Examination" VALUES ("High Cholesterol");