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

CREATE TABLE "Laboratory" (
"ID" INT,
"Date" DATE,
"CRP" TEXT,
PRIMARY KEY ("ID", "Date")
);

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



INSERT INTO "Patient" VALUES ("163109", "F", "1985-07-23", "Thrombosis");
INSERT INTO "Patient" VALUES ("163110", "M", "1970-11-15", "No thrombosis");
INSERT INTO "Patient" VALUES ("163111", "F", "1992-03-05", "Thrombosis");
INSERT INTO "Patient" VALUES ("163112", "M", "1980-12-30", "No thrombosis");
INSERT INTO "Patient" VALUES ("163113", "F", "1965-06-17", "Thrombosis");
INSERT INTO "Examination" VALUES ("163109", "2023-04-10", "Confirmed", "Swelling and pain in leg");
INSERT INTO "Examination" VALUES ("163110", "2023-04-12", "Negative", "No symptoms");
INSERT INTO "Examination" VALUES ("163111", "2023-04-15", "Confirmed", "Redness and warmth");
INSERT INTO "Examination" VALUES ("163112", "2023-04-18", "Negative", "No symptoms");
INSERT INTO "Examination" VALUES ("163113", "2023-04-20", "Confirmed", "Leg cramps and tenderness");
INSERT INTO "Laboratory" VALUES ("163109", "2023-04-09", "High");
INSERT INTO "Laboratory" VALUES ("163110", "2023-04-11", "Normal");
INSERT INTO "Laboratory" VALUES ("163111", "2023-04-14", "High");
INSERT INTO "Laboratory" VALUES ("163112", "2023-04-17", "Normal");
INSERT INTO "Laboratory" VALUES ("163113", "2023-04-19", "High");