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" (
"Examination Date" DATE
);

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,
"Birthday" DATE,
PRIMARY KEY ("ID")
);



INSERT INTO "Examination" VALUES ("1995-09-04");
INSERT INTO "Examination" VALUES ("1996-01-15");
INSERT INTO "Examination" VALUES ("1995-09-05");
INSERT INTO "Examination" VALUES ("1995-09-03");
INSERT INTO "Examination" VALUES ("1994-12-25");
INSERT INTO "Patient" VALUES ("2927464", "1970-05-10");
INSERT INTO "Patient" VALUES ("1234567", "1980-11-20");
INSERT INTO "Patient" VALUES ("9876543", "1965-03-15");
INSERT INTO "Patient" VALUES ("1122334", "1990-07-01");
INSERT INTO "Patient" VALUES ("5566778", "1975-01-22");
INSERT INTO "Laboratory" VALUES ("2927464", "1995-09-04", "240", "150");
INSERT INTO "Laboratory" VALUES ("2927464", "1995-09-05", "260", "180");
INSERT INTO "Laboratory" VALUES ("1234567", "1995-09-04", "200", "100");
INSERT INTO "Laboratory" VALUES ("2927464", "1996-01-15", "230", "140");
INSERT INTO "Laboratory" VALUES ("9876543", "1995-09-04", "270", "200");
INSERT INTO "Laboratory" VALUES ("2927464", "1994-12-25", "210", "130");
INSERT INTO "Laboratory" VALUES ("1122334", "1995-09-04", "220", "110");
INSERT INTO "Laboratory" VALUES ("5566778", "1995-09-04", "250", "160");