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" (
"ID" INT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"GLU" INT,
"HGB" FLOAT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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



INSERT INTO "Patient" VALUES ("1", "1991-03-15", "1991-03-15");
INSERT INTO "Patient" VALUES ("2", "1991-07-22", "1991-07-22");
INSERT INTO "Patient" VALUES ("3", "1990-12-30", "1990-12-30");
INSERT INTO "Patient" VALUES ("4", "1991-01-05", "1991-01-05");
INSERT INTO "Patient" VALUES ("5", "1992-06-10", "1992-06-10");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("2");
INSERT INTO "Examination" VALUES ("3");
INSERT INTO "Examination" VALUES ("4");
INSERT INTO "Examination" VALUES ("5");
INSERT INTO "Laboratory" VALUES ("1", "1991-03-16", "150", "13.5");
INSERT INTO "Laboratory" VALUES ("1", "1991-04-10", "185", "14.0");
INSERT INTO "Laboratory" VALUES ("2", "1991-07-23", "179", "12.8");
INSERT INTO "Laboratory" VALUES ("2", "1991-08-01", "181", "13.0");
INSERT INTO "Laboratory" VALUES ("3", "1990-12-31", "170", "14.2");
INSERT INTO "Laboratory" VALUES ("4", "1991-01-06", "160", "13.1");
INSERT INTO "Laboratory" VALUES ("4", "1991-02-15", "200", "13.3");
INSERT INTO "Laboratory" VALUES ("5", "1992-06-11", "175", "12.9");