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" (
"Thrombosis" INT
);

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,
"SEX" TEXT,
"Diagnosis" TEXT,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "M", "Hypertension");
INSERT INTO "Patient" VALUES ("2", "F", "Diabetes");
INSERT INTO "Patient" VALUES ("3", "M", "Hyperlipidemia");
INSERT INTO "Patient" VALUES ("4", "F", "Healthy");
INSERT INTO "Patient" VALUES ("5", "M", "Obesity");
INSERT INTO "Patient" VALUES ("6", "F", "Cardiovascular Disease");
INSERT INTO "Laboratory" VALUES ("1", "2024-01-10", "220", "280");
INSERT INTO "Laboratory" VALUES ("1", "2024-02-15", "210", "310");
INSERT INTO "Laboratory" VALUES ("2", "2024-01-12", "180", "290");
INSERT INTO "Laboratory" VALUES ("2", "2024-03-20", "190", "305");
INSERT INTO "Laboratory" VALUES ("3", "2024-01-05", "250", "320");
INSERT INTO "Laboratory" VALUES ("3", "2024-04-10", "260", "330");
INSERT INTO "Laboratory" VALUES ("4", "2024-02-01", "200", "150");
INSERT INTO "Laboratory" VALUES ("5", "2024-03-15", "230", "400");
INSERT INTO "Laboratory" VALUES ("5", "2024-05-01", "240", "350");
INSERT INTO "Laboratory" VALUES ("6", "2024-01-20", "210", "280");
INSERT INTO "Laboratory" VALUES ("6", "2024-06-10", "220", "310");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("1");
INSERT INTO "Examination" VALUES ("0");