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



INSERT INTO "Patient" VALUES ("1", "1980-05-12");
INSERT INTO "Patient" VALUES ("2", "1975-11-23");
INSERT INTO "Patient" VALUES ("3", "1990-07-30");
INSERT INTO "Patient" VALUES ("4", "1985-01-15");
INSERT INTO "Patient" VALUES ("5", "2000-12-01");
INSERT INTO "Patient" VALUES ("6", "1968-03-22");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "25", "59");
INSERT INTO "Laboratory" VALUES ("1", "2023-02-15", "30", "58");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-12", "20", "45");
INSERT INTO "Laboratory" VALUES ("2", "2023-03-10", "22", "59");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-20", "18", "60");
INSERT INTO "Laboratory" VALUES ("3", "2023-02-25", "19", "55");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-18", "28", "59");
INSERT INTO "Laboratory" VALUES ("4", "2023-03-05", "27", "57");
INSERT INTO "Laboratory" VALUES ("5", "2023-02-01", "24", "61");
INSERT INTO "Laboratory" VALUES ("5", "2023-03-15", "23", "62");
INSERT INTO "Laboratory" VALUES ("6", "2023-01-22", "26", "59");
INSERT INTO "Laboratory" VALUES ("6", "2023-02-28", "25", "58");
INSERT INTO "Examination" VALUES ("2023-01-10");
INSERT INTO "Examination" VALUES ("2023-01-12");
INSERT INTO "Examination" VALUES ("2023-01-18");
INSERT INTO "Examination" VALUES ("2023-01-20");
INSERT INTO "Examination" VALUES ("2023-01-22");
INSERT INTO "Examination" VALUES ("2023-02-01");
INSERT INTO "Examination" VALUES ("2023-02-15");
INSERT INTO "Examination" VALUES ("2023-02-25");
INSERT INTO "Examination" VALUES ("2023-02-28");
INSERT INTO "Examination" VALUES ("2023-03-05");
INSERT INTO "Examination" VALUES ("2023-03-10");
INSERT INTO "Examination" VALUES ("2023-03-15");