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,
"Diagnosis" TEXT,
"Symptoms" TEXT,
"Thrombosis" INT,
FOREIGN KEY ("ID") REFERENCES "Patient"("ID")
);

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"PLT" 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", "Fever");
INSERT INTO "Patient" VALUES ("2", "F", "Headache");
INSERT INTO "Patient" VALUES ("3", "M", "Cough");
INSERT INTO "Patient" VALUES ("4", "F", "Fatigue");
INSERT INTO "Patient" VALUES ("5", "M", "Nausea");
INSERT INTO "Patient" VALUES ("6", "F", "Dizziness");
INSERT INTO "Patient" VALUES ("7", "M", "Sore Throat");
INSERT INTO "Patient" VALUES ("8", "F", "Rash");
INSERT INTO "Patient" VALUES ("9", "M", "Muscle Pain");
INSERT INTO "Patient" VALUES ("10", "F", "Joint Pain");
INSERT INTO "Examination" VALUES ("1", "Flu", "Body aches", "0");
INSERT INTO "Examination" VALUES ("2", "Migraine", "NULL", "0");
INSERT INTO "Examination" VALUES ("3", "Bronchitis", "Chest pain", "0");
INSERT INTO "Examination" VALUES ("4", "Anemia", "Weakness", "0");
INSERT INTO "Examination" VALUES ("5", "Food Poisoning", "Vomiting", "0");
INSERT INTO "Examination" VALUES ("6", "Vertigo", "Imbalance", "0");
INSERT INTO "Examination" VALUES ("7", "Strep Throat", "Swollen glands", "0");
INSERT INTO "Examination" VALUES ("8", "Allergy", "Itching", "0");
INSERT INTO "Examination" VALUES ("9", "Fibromyalgia", "Tender points", "0");
INSERT INTO "Examination" VALUES ("10", "Arthritis", "Stiffness", "0");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10", "150");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-11", "300");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-12", "50");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-13", "450");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-14", "200");
INSERT INTO "Laboratory" VALUES ("6", "2023-01-15", "120");
INSERT INTO "Laboratory" VALUES ("7", "2023-01-16", "380");
INSERT INTO "Laboratory" VALUES ("8", "2023-01-17", "90");
INSERT INTO "Laboratory" VALUES ("9", "2023-01-18", "250");
INSERT INTO "Laboratory" VALUES ("10", "2023-01-19", "180");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-20", "110");
INSERT INTO "Laboratory" VALUES ("2", "2023-01-21", "410");
INSERT INTO "Laboratory" VALUES ("3", "2023-01-22", "105");
INSERT INTO "Laboratory" VALUES ("4", "2023-01-23", "390");
INSERT INTO "Laboratory" VALUES ("5", "2023-01-24", "95");