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

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

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



INSERT INTO "Patient" VALUES ("1", "M", "1975-06-15");
INSERT INTO "Patient" VALUES ("2", "F", "1973-12-01");
INSERT INTO "Patient" VALUES ("3", "M", "1972-05-20");
INSERT INTO "Patient" VALUES ("4", "F", "1972-05-20");
INSERT INTO "Patient" VALUES ("5", "M", "1970-01-01");
INSERT INTO "Patient" VALUES ("6", "F", "1976-11-30");
INSERT INTO "Patient" VALUES ("7", "M", "1974-07-10");
INSERT INTO "Patient" VALUES ("8", "F", "1965-03-15");
INSERT INTO "Patient" VALUES ("9", "M", "1978-09-25");
INSERT INTO "Patient" VALUES ("10", "F", "1971-08-05");
INSERT INTO "Examination" VALUES ("1", "1990-06-15", "Diagnosis A");
INSERT INTO "Examination" VALUES ("1", "1992-07-20", "Diagnosis B");
INSERT INTO "Examination" VALUES ("2", "1990-12-01", "Diagnosis C");
INSERT INTO "Examination" VALUES ("3", "1990-05-10", "Diagnosis D");
INSERT INTO "Examination" VALUES ("3", "1990-06-01", "Diagnosis E");
INSERT INTO "Examination" VALUES ("4", "1990-06-01", "Diagnosis F");
INSERT INTO "Examination" VALUES ("5", "1991-03-15", "Diagnosis G");
INSERT INTO "Examination" VALUES ("6", "1991-11-30", "Diagnosis H");
INSERT INTO "Examination" VALUES ("7", "1990-07-09", "Diagnosis I");
INSERT INTO "Examination" VALUES ("7", "1992-08-15", "Diagnosis J");
INSERT INTO "Examination" VALUES ("7", "1993-07-11", "Diagnosis K");
INSERT INTO "Examination" VALUES ("8", "1992-04-10", "Diagnosis L");
INSERT INTO "Examination" VALUES ("9", "1993-09-24", "Diagnosis M");
INSERT INTO "Examination" VALUES ("10", "1991-08-05", "Diagnosis N");