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

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

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



INSERT INTO "Patient" VALUES ("1", "M", "1970-05-10");
INSERT INTO "Patient" VALUES ("2", "F", "1985-11-22");
INSERT INTO "Patient" VALUES ("3", "M", "1965-03-15");
INSERT INTO "Patient" VALUES ("4", "M", "1990-01-01");
INSERT INTO "Patient" VALUES ("5", "F", "1978-07-30");
INSERT INTO "Patient" VALUES ("6", "M", "1982-09-05");
INSERT INTO "Patient" VALUES ("7", "M", "1975-02-28");
INSERT INTO "Patient" VALUES ("8", "F", "1995-04-12");
INSERT INTO "Patient" VALUES ("9", "M", "1960-08-18");
INSERT INTO "Patient" VALUES ("10", "M", "1988-06-25");
INSERT INTO "Examination" VALUES ("1", "1998-01-15");
INSERT INTO "Examination" VALUES ("2", "1998-02-20");
INSERT INTO "Examination" VALUES ("3", "1998-03-10");
INSERT INTO "Examination" VALUES ("4", "1998-04-05");
INSERT INTO "Examination" VALUES ("5", "1998-05-01");
INSERT INTO "Examination" VALUES ("6", "1998-06-11");
INSERT INTO "Examination" VALUES ("7", "1998-07-22");
INSERT INTO "Examination" VALUES ("8", "1998-08-08");
INSERT INTO "Examination" VALUES ("9", "1998-09-19");
INSERT INTO "Examination" VALUES ("10", "1998-10-25");
INSERT INTO "Examination" VALUES ("1", "1999-01-01");
INSERT INTO "Examination" VALUES ("3", "1997-12-31");
INSERT INTO "Laboratory" VALUES ("1", "1998-01-20");
INSERT INTO "Laboratory" VALUES ("3", "1998-03-15");
INSERT INTO "Laboratory" VALUES ("4", "1998-04-10");
INSERT INTO "Laboratory" VALUES ("6", "1998-06-15");
INSERT INTO "Laboratory" VALUES ("7", "1998-07-25");
INSERT INTO "Laboratory" VALUES ("9", "1998-09-20");
INSERT INTO "Laboratory" VALUES ("10", "1998-10-30");
INSERT INTO "Laboratory" VALUES ("1", "1998-02-01");
INSERT INTO "Laboratory" VALUES ("3", "1998-05-01");
INSERT INTO "Laboratory" VALUES ("4", "1998-08-01");
INSERT INTO "Laboratory" VALUES ("6", "1998-11-01");
INSERT INTO "Laboratory" VALUES ("7", "1998-12-01");
INSERT INTO "Laboratory" VALUES ("2", "1998-02-25");
INSERT INTO "Laboratory" VALUES ("5", "1998-05-05");
INSERT INTO "Laboratory" VALUES ("8", "1998-08-10");
INSERT INTO "Laboratory" VALUES ("1", "1997-12-01");
INSERT INTO "Laboratory" VALUES ("3", "1999-01-01");