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

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



INSERT INTO "Examination" VALUES ("1991-10-05", "Thrombosis");
INSERT INTO "Examination" VALUES ("1991-10-15", "No Thrombosis");
INSERT INTO "Examination" VALUES ("1991-09-20", "Thrombosis");
INSERT INTO "Examination" VALUES ("1991-11-01", "No Thrombosis");
INSERT INTO "Examination" VALUES ("1991-10-25", "Thrombosis");
INSERT INTO "Examination" VALUES ("1991-10-10", "No Thrombosis");
INSERT INTO "Examination" VALUES ("1991-10-01", "Thrombosis");
INSERT INTO "Examination" VALUES ("1991-10-30", "No Thrombosis");
INSERT INTO "Laboratory" VALUES ("1", "1991-10-01", "1.5");
INSERT INTO "Laboratory" VALUES ("1", "1991-10-15", "2.1");
INSERT INTO "Laboratory" VALUES ("2", "1991-10-05", "1.8");
INSERT INTO "Laboratory" VALUES ("3", "1991-09-25", "1.0");
INSERT INTO "Laboratory" VALUES ("4", "1991-10-10", "2.5");
INSERT INTO "Laboratory" VALUES ("5", "1991-10-20", "1.2");
INSERT INTO "Laboratory" VALUES ("6", "1991-10-03", "1.9");
INSERT INTO "Laboratory" VALUES ("7", "1991-10-28", "0.9");
INSERT INTO "Laboratory" VALUES ("8", "1991-11-02", "1.7");
INSERT INTO "Laboratory" VALUES ("9", "1991-10-07", "1.6");
INSERT INTO "Laboratory" VALUES ("10", "1991-10-12", "2.0");
INSERT INTO "Laboratory" VALUES ("11", "1991-10-04", "1.1");
INSERT INTO "Laboratory" VALUES ("12", "1991-10-08", "1.3");
INSERT INTO "Patient" VALUES ("1", "1991-09-01", "-");
INSERT INTO "Patient" VALUES ("2", "1991-09-10", "-");
INSERT INTO "Patient" VALUES ("3", "1991-08-15", "Inpatient");
INSERT INTO "Patient" VALUES ("4", "1991-09-20", "-");
INSERT INTO "Patient" VALUES ("5", "1991-09-25", "-");
INSERT INTO "Patient" VALUES ("6", "1991-09-05", "Inpatient");
INSERT INTO "Patient" VALUES ("7", "1991-09-12", "-");
INSERT INTO "Patient" VALUES ("8", "1991-10-01", "-");
INSERT INTO "Patient" VALUES ("9", "1991-09-18", "-");
INSERT INTO "Patient" VALUES ("10", "1991-09-03", "Inpatient");
INSERT INTO "Patient" VALUES ("11", "1991-09-06", "-");
INSERT INTO "Patient" VALUES ("12", "1991-09-09", "-");