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,
"Diagnosis" TEXT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"T-CHO" INT,
"GLU" INT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"Description" DATE,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "1991-01-15");
INSERT INTO "Patient" VALUES ("2", "1991-03-20");
INSERT INTO "Patient" VALUES ("3", "1992-05-10");
INSERT INTO "Patient" VALUES ("4", "1991-07-01");
INSERT INTO "Patient" VALUES ("5", "1990-11-22");
INSERT INTO "Patient" VALUES ("6", "1991-02-28");
INSERT INTO "Patient" VALUES ("7", "1993-09-05");
INSERT INTO "Laboratory" VALUES ("1", "1991-01-15", "200", "120");
INSERT INTO "Laboratory" VALUES ("1", "1991-06-01", "210", "190");
INSERT INTO "Laboratory" VALUES ("2", "1991-03-20", "180", "150");
INSERT INTO "Laboratory" VALUES ("2", "1991-08-10", "190", "175");
INSERT INTO "Laboratory" VALUES ("3", "1992-05-10", "220", "160");
INSERT INTO "Laboratory" VALUES ("4", "1991-07-01", "170", "110");
INSERT INTO "Laboratory" VALUES ("4", "1991-12-05", "185", "185");
INSERT INTO "Laboratory" VALUES ("5", "1990-11-22", "230", "130");
INSERT INTO "Laboratory" VALUES ("6", "1991-02-28", "195", "140");
INSERT INTO "Laboratory" VALUES ("6", "1991-09-15", "205", "200");
INSERT INTO "Laboratory" VALUES ("7", "1993-09-05", "160", "100");
INSERT INTO "Examination" VALUES ("1991-01-15", "Normal");
INSERT INTO "Examination" VALUES ("1991-03-20", "Normal");
INSERT INTO "Examination" VALUES ("1992-05-10", "High Cholesterol");
INSERT INTO "Examination" VALUES ("1991-07-01", "Normal");
INSERT INTO "Examination" VALUES ("1990-11-22", "Normal");
INSERT INTO "Examination" VALUES ("1991-02-28", "Normal");
INSERT INTO "Examination" VALUES ("1993-09-05", "Normal");