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

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"SEX" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "M");
INSERT INTO "Patient" VALUES ("2", "F");
INSERT INTO "Patient" VALUES ("3", "M");
INSERT INTO "Patient" VALUES ("4", "F");
INSERT INTO "Patient" VALUES ("5", "M");
INSERT INTO "Laboratory" VALUES ("1", "1992-06-12", "50", "9");
INSERT INTO "Laboratory" VALUES ("2", "1992-06-12", "45", "12");
INSERT INTO "Laboratory" VALUES ("3", "1992-06-13", "60", "8");
INSERT INTO "Laboratory" VALUES ("4", "1992-06-12", "55", "9");
INSERT INTO "Laboratory" VALUES ("5", "1992-06-11", "40", "7");
INSERT INTO "Laboratory" VALUES ("1", "1992-06-13", "52", "10");
INSERT INTO "Laboratory" VALUES ("4", "1992-06-13", "58", "11");
INSERT INTO "Examination" VALUES ("1992-06-12", "Normal");
INSERT INTO "Examination" VALUES ("1992-06-13", "Elevated Enzymes");
INSERT INTO "Examination" VALUES ("1992-06-11", "Routine Checkup");