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,
"GOT" INT,
"GPT" 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", "1960-05-20");
INSERT INTO "Patient" VALUES ("2", "F", "1975-11-15");
INSERT INTO "Patient" VALUES ("3", "M", "1980-01-30");
INSERT INTO "Patient" VALUES ("4", "F", "1990-07-22");
INSERT INTO "Patient" VALUES ("5", "M", "1955-03-10");
INSERT INTO "Laboratory" VALUES ("1", "1992-06-12", "15", "9");
INSERT INTO "Laboratory" VALUES ("2", "1992-06-12", "20", "7");
INSERT INTO "Laboratory" VALUES ("3", "1992-06-12", "9", "10");
INSERT INTO "Laboratory" VALUES ("4", "1992-06-12", "12", "8");
INSERT INTO "Laboratory" VALUES ("5", "1992-06-12", "18", "9");
INSERT INTO "Examination" VALUES ("1992-06-12");
INSERT INTO "Examination" VALUES ("1992-06-11");
INSERT INTO "Examination" VALUES ("1992-06-13");
INSERT INTO "Examination" VALUES ("1993-01-01");
INSERT INTO "Examination" VALUES ("1991-12-31");