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



INSERT INTO "Examination" VALUES ("1994-01-15");
INSERT INTO "Examination" VALUES ("1994-03-20");
INSERT INTO "Examination" VALUES ("1995-07-10");
INSERT INTO "Examination" VALUES ("1993-11-01");
INSERT INTO "Examination" VALUES ("1994-05-25");
INSERT INTO "Examination" VALUES ("1996-02-18");
INSERT INTO "Patient" VALUES ("1", "M", "1970-05-10", "1993-01-01");
INSERT INTO "Patient" VALUES ("2", "F", "1982-11-22", "1994-02-15");
INSERT INTO "Patient" VALUES ("3", "M", "1965-03-01", "1992-06-01");
INSERT INTO "Patient" VALUES ("4", "F", "1990-08-14", "1994-04-01");
INSERT INTO "Patient" VALUES ("5", "M", "1975-01-30", "1993-09-01");
INSERT INTO "Patient" VALUES ("6", "F", "1988-06-05", "1995-01-01");
INSERT INTO "Patient" VALUES ("7", "M", "1960-12-25", "1994-01-01");
INSERT INTO "Laboratory" VALUES ("1", "1994-01-15", "45", "30");
INSERT INTO "Laboratory" VALUES ("1", "1994-03-20", "65", "40");
INSERT INTO "Laboratory" VALUES ("2", "1994-02-15", "50", "35");
INSERT INTO "Laboratory" VALUES ("3", "1994-05-25", "55", "42");
INSERT INTO "Laboratory" VALUES ("3", "1993-11-01", "40", "28");
INSERT INTO "Laboratory" VALUES ("4", "1994-04-01", "70", "50");
INSERT INTO "Laboratory" VALUES ("5", "1994-06-10", "58", "38");
INSERT INTO "Laboratory" VALUES ("5", "1995-01-05", "48", "32");
INSERT INTO "Laboratory" VALUES ("7", "1994-01-01", "52", "33");
INSERT INTO "Laboratory" VALUES ("7", "1994-07-01", "59", "39");
INSERT INTO "Laboratory" VALUES ("1", "1995-01-01", "42", "29");
INSERT INTO "Laboratory" VALUES ("2", "1995-03-01", "62", "45");