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" (
"ID" INT,
"Examination Date" DATE,
"ANA" INT,
"ANA Pattern" TEXT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

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", "Healthy");
INSERT INTO "Patient" VALUES ("4", "Hyperlipidemia");
INSERT INTO "Patient" VALUES ("5", "Cardiovascular");
INSERT INTO "Patient" VALUES ("6", "Obesity");
INSERT INTO "Patient" VALUES ("7", "Asthma");
INSERT INTO "Patient" VALUES ("8", "Healthy");
INSERT INTO "Patient" VALUES ("9", "Diabetes");
INSERT INTO "Patient" VALUES ("10", "Hypertension");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "249", "150");
INSERT INTO "Laboratory" VALUES ("1", "2023-06-10", "251", "160");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-15", "200", "180");
INSERT INTO "Laboratory" VALUES ("2", "2023-07-15", "245", "170");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-20", "250", "190");
INSERT INTO "Laboratory" VALUES ("3", "2023-08-20", "240", "200");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-25", "260", "210");
INSERT INTO "Laboratory" VALUES ("4", "2023-09-25", "255", "220");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-30", "180", "230");
INSERT INTO "Laboratory" VALUES ("5", "2023-10-30", "190", "240");
INSERT INTO "Laboratory" VALUES ("6", "2023-01-05", "249", "250");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-05", "248", "260");
INSERT INTO "Laboratory" VALUES ("7", "2023-02-10", "251", "270");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-10", "252", "280");
INSERT INTO "Laboratory" VALUES ("8", "2023-03-15", "230", "290");
INSERT INTO "Laboratory" VALUES ("8", "2023-08-15", "240", "300");
INSERT INTO "Laboratory" VALUES ("9", "2023-04-20", "249", "310");
INSERT INTO "Laboratory" VALUES ("9", "2023-09-20", "251", "320");
INSERT INTO "Laboratory" VALUES ("10", "2023-05-25", "200", "330");
INSERT INTO "Laboratory" VALUES ("10", "2023-10-25", "199", "340");
INSERT INTO "Examination" VALUES ("1", "2023-01-11", "120", "P");
INSERT INTO "Examination" VALUES ("1", "2023-06-11", "130", "N");
INSERT INTO "Examination" VALUES ("2", "2023-02-16", "110", "Q");
INSERT INTO "Examination" VALUES ("2", "2023-07-16", "115", "P");
INSERT INTO "Examination" VALUES ("3", "2023-03-21", "100", "N");
INSERT INTO "Examination" VALUES ("3", "2023-08-21", "105", "R");
INSERT INTO "Examination" VALUES ("4", "2023-04-26", "140", "P");
INSERT INTO "Examination" VALUES ("4", "2023-09-26", "135", "N");
INSERT INTO "Examination" VALUES ("5", "2023-05-31", "125", "S");
INSERT INTO "Examination" VALUES ("5", "2023-11-01", "130", "P");
INSERT INTO "Examination" VALUES ("6", "2023-01-06", "115", "P");
INSERT INTO "Examination" VALUES ("6", "2023-06-06", "120", "T");
INSERT INTO "Examination" VALUES ("7", "2023-02-11", "130", "N");
INSERT INTO "Examination" VALUES ("7", "2023-07-11", "135", "P");
INSERT INTO "Examination" VALUES ("8", "2023-03-16", "110", "U");
INSERT INTO "Examination" VALUES ("8", "2023-08-16", "115", "P");
INSERT INTO "Examination" VALUES ("9", "2023-04-21", "105", "P");
INSERT INTO "Examination" VALUES ("9", "2023-09-21", "100", "N");
INSERT INTO "Examination" VALUES ("10", "2023-05-26", "95", "N");
INSERT INTO "Examination" VALUES ("10", "2023-10-26", "90", "P");