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-05-20");
INSERT INTO "Patient" VALUES ("2", "F", "1973-11-15");
INSERT INTO "Patient" VALUES ("3", "M", "1978-07-30");
INSERT INTO "Patient" VALUES ("4", "F", "1972-12-01");
INSERT INTO "Patient" VALUES ("5", "M", "1976-03-10");
INSERT INTO "Patient" VALUES ("6", "F", "1974-08-25");
INSERT INTO "Patient" VALUES ("7", "M", "1979-01-05");
INSERT INTO "Patient" VALUES ("8", "F", "1971-09-17");
INSERT INTO "Patient" VALUES ("9", "M", "1973-06-22");
INSERT INTO "Patient" VALUES ("10", "F", "1977-04-12");
INSERT INTO "Examination" VALUES ("1", "1990-06-15", "Diagnosis A");
INSERT INTO "Examination" VALUES ("2", "1991-07-20", "Diagnosis B");
INSERT INTO "Examination" VALUES ("3", "1992-08-25", "Diagnosis C");
INSERT INTO "Examination" VALUES ("4", "1993-09-30", "Diagnosis D");
INSERT INTO "Examination" VALUES ("5", "1990-10-05", "Diagnosis E");
INSERT INTO "Examination" VALUES ("6", "1991-11-10", "Diagnosis F");
INSERT INTO "Examination" VALUES ("7", "1992-12-15", "Diagnosis G");
INSERT INTO "Examination" VALUES ("8", "1993-01-20", "Diagnosis H");
INSERT INTO "Examination" VALUES ("9", "1994-02-25", "Diagnosis I");
INSERT INTO "Examination" VALUES ("10", "1989-03-30", "Diagnosis J");
INSERT INTO "Laboratory" VALUES ("1", "1990-06-15");
INSERT INTO "Laboratory" VALUES ("2", "1991-07-20");
INSERT INTO "Laboratory" VALUES ("3", "1992-08-25");
INSERT INTO "Laboratory" VALUES ("4", "1993-09-30");
INSERT INTO "Laboratory" VALUES ("5", "1990-10-05");
INSERT INTO "Laboratory" VALUES ("6", "1991-11-10");
INSERT INTO "Laboratory" VALUES ("7", "1992-12-15");
INSERT INTO "Laboratory" VALUES ("8", "1993-01-20");
INSERT INTO "Laboratory" VALUES ("9", "1994-02-25");
INSERT INTO "Laboratory" VALUES ("10", "1989-03-30");