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

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



INSERT INTO "Patient" VALUES ("1", "M", "1980-05-12", "2024-01-10");
INSERT INTO "Patient" VALUES ("2", "F", "1975-11-23", "2024-02-15");
INSERT INTO "Patient" VALUES ("3", "M", "1990-07-30", "2024-03-05");
INSERT INTO "Patient" VALUES ("4", "F", "1965-12-01", "2024-01-20");
INSERT INTO "Patient" VALUES ("5", "M", "1988-04-17", "2024-02-28");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-11", "45", "50", "1.2");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-15", "48", "52", "1.5");
INSERT INTO "Laboratory" VALUES ("2", "2024-02-16", "40", "45", "2.3");
INSERT INTO "Laboratory" VALUES ("2", "2024-02-20", "42", "47", "2.3");
INSERT INTO "Laboratory" VALUES ("3", "2024-03-06", "38", "44", "1.8");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-21", "50", "55", "3.7");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-25", "52", "57", "3.7");
INSERT INTO "Laboratory" VALUES ("5", "2024-03-01", "44", "49", "2.9");
INSERT INTO "Laboratory" VALUES ("5", "2024-03-05", "46", "51", "3.0");