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" (
"Diagnosis" TEXT
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"TP" FLOAT,
"ALB" FLOAT,
PRIMARY KEY ("ID", "Date"),
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Patient" (
"ID" INT UNIQUE,
"SEX" TEXT,
"Diagnosis" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Examination" VALUES ("SJS");
INSERT INTO "Examination" VALUES ("Other");
INSERT INTO "Examination" VALUES ("SJS");
INSERT INTO "Examination" VALUES ("None");
INSERT INTO "Patient" VALUES ("1", "M", "SJS");
INSERT INTO "Patient" VALUES ("2", "F", "SJS");
INSERT INTO "Patient" VALUES ("3", "M", "Other");
INSERT INTO "Patient" VALUES ("4", "F", "SJS");
INSERT INTO "Patient" VALUES ("5", "M", "None");
INSERT INTO "Patient" VALUES ("6", "F", "SJS");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "7.2", "4.0");
INSERT INTO "Laboratory" VALUES ("1", "2024-02-15", "6.5", "3.8");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-12", "5.9", "4.1");
INSERT INTO "Laboratory" VALUES ("2", "2024-03-10", "7.0", "4.2");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-20", "7.8", "3.9");
INSERT INTO "Laboratory" VALUES ("4", "2024-02-01", "8.6", "4.3");
INSERT INTO "Laboratory" VALUES ("4", "2024-02-20", "7.5", "4.0");
INSERT INTO "Laboratory" VALUES ("5", "2024-01-25", "6.8", "3.7");
INSERT INTO "Laboratory" VALUES ("6", "2024-03-05", "6.1", "4.1");
INSERT INTO "Laboratory" VALUES ("6", "2024-03-15", "8.4", "4.2");