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" (
"Examination Date" DATE,
"Diagnosis" TEXT
);

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

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



INSERT INTO "Examination" VALUES ("2023-01-15", "AORTITIS");
INSERT INTO "Examination" VALUES ("2023-02-20", "THROMBOSIS");
INSERT INTO "Examination" VALUES ("2023-03-10", "AORTITIS");
INSERT INTO "Examination" VALUES ("2023-04-05", "DIABETES");
INSERT INTO "Examination" VALUES ("2023-05-01", "AORTITIS");
INSERT INTO "Examination" VALUES ("2023-06-12", "THROMBOSIS");
INSERT INTO "Examination" VALUES ("2023-07-01", "AORTITIS");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-10");
INSERT INTO "Laboratory" VALUES ("1", "2023-01-15");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-18");
INSERT INTO "Laboratory" VALUES ("2", "2023-02-20");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-08");
INSERT INTO "Laboratory" VALUES ("3", "2023-03-10");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-01");
INSERT INTO "Laboratory" VALUES ("4", "2023-04-05");
INSERT INTO "Laboratory" VALUES ("5", "2023-04-28");
INSERT INTO "Laboratory" VALUES ("5", "2023-05-01");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-10");
INSERT INTO "Laboratory" VALUES ("6", "2023-06-12");
INSERT INTO "Laboratory" VALUES ("7", "2023-06-29");
INSERT INTO "Laboratory" VALUES ("7", "2023-07-01");
INSERT INTO "Patient" VALUES ("1", "Male", "2023-01-15", "AORTITIS");
INSERT INTO "Patient" VALUES ("2", "Female", "2023-02-20", "THROMBOSIS");
INSERT INTO "Patient" VALUES ("3", "Female", "2023-03-10", "AORTITIS");
INSERT INTO "Patient" VALUES ("4", "Male", "2023-04-05", "DIABETES");
INSERT INTO "Patient" VALUES ("5", "Male", "2023-05-01", "AORTITIS");
INSERT INTO "Patient" VALUES ("6", "Female", "2023-06-12", "THROMBOSIS");
INSERT INTO "Patient" VALUES ("7", "Female", "2023-07-01", "AORTITIS");