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

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



INSERT INTO "Patient" VALUES ("1", "Hypertension");
INSERT INTO "Patient" VALUES ("2", "Diabetes");
INSERT INTO "Patient" VALUES ("3", "Hyperlipidemia");
INSERT INTO "Patient" VALUES ("4", "Coronary Artery Disease");
INSERT INTO "Patient" VALUES ("5", "Obesity");
INSERT INTO "Patient" VALUES ("6", "Metabolic Syndrome");
INSERT INTO "Patient" VALUES ("7", "Hypothyroidism");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "180", "150");
INSERT INTO "Laboratory" VALUES ("1", "2024-02-15", "190", "199");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-12", "210", "180");
INSERT INTO "Laboratory" VALUES ("2", "2024-03-01", "220", "175");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-20", "230", "198");
INSERT INTO "Laboratory" VALUES ("3", "2024-02-25", "240", "195");
INSERT INTO "Laboratory" VALUES ("4", "2024-01-30", "200", "160");
INSERT INTO "Laboratory" VALUES ("4", "2024-03-10", "205", "170");
INSERT INTO "Laboratory" VALUES ("5", "2024-02-05", "190", "199");
INSERT INTO "Laboratory" VALUES ("5", "2024-03-15", "185", "180");
INSERT INTO "Laboratory" VALUES ("6", "2024-01-18", "195", "140");
INSERT INTO "Laboratory" VALUES ("6", "2024-02-22", "200", "130");
INSERT INTO "Laboratory" VALUES ("7", "2024-01-25", "180", "100");
INSERT INTO "Laboratory" VALUES ("7", "2024-03-05", "175", "110");