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

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



INSERT INTO "Patient" VALUES ("1", "1959-03-01", "2023-01-15");
INSERT INTO "Patient" VALUES ("2", "1965-07-20", "2023-02-10");
INSERT INTO "Patient" VALUES ("3", "1959-03-01", "2023-03-05");
INSERT INTO "Patient" VALUES ("4", "1970-11-30", "2023-01-25");
INSERT INTO "Patient" VALUES ("5", "1980-05-14", "2023-02-20");
INSERT INTO "Examination" VALUES ("1", "1993-09-27", "Deep Vein Thrombosis", "Swelling and pain in the leg");
INSERT INTO "Examination" VALUES ("1", "1994-01-15", "No thrombosis", "No symptoms");
INSERT INTO "Examination" VALUES ("2", "1993-09-27", "Pulmonary Embolism", "Shortness of breath and chest pain");
INSERT INTO "Examination" VALUES ("3", "1993-09-27", "Superficial Thrombophlebitis", "Redness and tenderness along the vein");
INSERT INTO "Examination" VALUES ("3", "1995-05-10", "No thrombosis", "No symptoms");
INSERT INTO "Examination" VALUES ("4", "1993-09-27", "No thrombosis", "No symptoms");
INSERT INTO "Examination" VALUES ("5", "1993-09-27", "Deep Vein Thrombosis", "Leg pain and warmth");
INSERT INTO "Laboratory" VALUES ("1", "1993-09-27");
INSERT INTO "Laboratory" VALUES ("1", "1994-01-15");
INSERT INTO "Laboratory" VALUES ("2", "1993-09-27");
INSERT INTO "Laboratory" VALUES ("3", "1993-09-27");
INSERT INTO "Laboratory" VALUES ("4", "1993-09-27");
INSERT INTO "Laboratory" VALUES ("5", "1993-09-27");