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



INSERT INTO "Examination" VALUES ("Normal");
INSERT INTO "Examination" VALUES ("Thrombosis");
INSERT INTO "Examination" VALUES ("High Cholesterol");
INSERT INTO "Examination" VALUES ("Low Blood Pressure");
INSERT INTO "Examination" VALUES ("Diabetes");
INSERT INTO "Patient" VALUES ("1", "M", "1980-05-10");
INSERT INTO "Patient" VALUES ("2", "F", "1995-11-22");
INSERT INTO "Patient" VALUES ("3", "M", "1970-01-15");
INSERT INTO "Patient" VALUES ("4", "F", "2000-03-01");
INSERT INTO "Patient" VALUES ("5", "M", "1965-07-30");
INSERT INTO "Patient" VALUES ("6", "F", "1990-09-12");
INSERT INTO "Patient" VALUES ("7", "M", "1985-02-28");
INSERT INTO "Patient" VALUES ("8", "F", "1975-04-05");
INSERT INTO "Patient" VALUES ("9", "M", "1950-12-25");
INSERT INTO "Patient" VALUES ("10", "F", "2010-06-18");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-01", "180", "150");
INSERT INTO "Laboratory" VALUES ("1", "2023-06-15", "210", "220");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-10", "190", "180");
INSERT INTO "Laboratory" VALUES ("2", "2023-07-20", "200", "250");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-05", "220", "280");
INSERT INTO "Laboratory" VALUES ("3", "2023-08-01", "230", "190");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-12", "170", "160");
INSERT INTO "Laboratory" VALUES ("4", "2023-09-03", "185", "210");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-20", "240", "300");
INSERT INTO "Laboratory" VALUES ("5", "2023-10-10", "250", "290");
INSERT INTO "Laboratory" VALUES ("6", "2023-01-25", "195", "175");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-30", "205", "230");
INSERT INTO "Laboratory" VALUES ("7", "2023-02-15", "215", "260");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-25", "225", "185");
INSERT INTO "Laboratory" VALUES ("8", "2023-03-22", "180", "170");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-15", "190", "205");
INSERT INTO "Laboratory" VALUES ("9", "2023-04-01", "260", "320");
INSERT INTO "Laboratory" VALUES ("9", "2023-09-20", "270", "310");
INSERT INTO "Laboratory" VALUES ("10", "2023-05-05", "160", "140");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-01", "170", "190");