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")
);

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



INSERT INTO "Patient" VALUES ("1", "M", "1980-05-10", "1990-01-15");
INSERT INTO "Patient" VALUES ("2", "F", "1975-11-22", "1991-03-01");
INSERT INTO "Patient" VALUES ("3", "M", "1985-01-01", "1990-07-20");
INSERT INTO "Patient" VALUES ("4", "F", "1972-08-15", "1992-02-10");
INSERT INTO "Patient" VALUES ("5", "M", "1988-03-03", "1993-04-05");
INSERT INTO "Patient" VALUES ("6", "F", "1990-06-01", "1990-06-01");
INSERT INTO "Patient" VALUES ("7", "M", "1970-01-01", "1989-12-31");
INSERT INTO "Patient" VALUES ("8", "F", "1989-12-31", "1990-01-01");
INSERT INTO "Patient" VALUES ("9", "M", "1973-07-07", "1991-09-09");
INSERT INTO "Patient" VALUES ("10", "F", "1986-02-14", "1992-05-20");
INSERT INTO "Examination" VALUES ("1", "1990-02-01");
INSERT INTO "Examination" VALUES ("1", "1991-01-01");
INSERT INTO "Examination" VALUES ("2", "1991-04-10");
INSERT INTO "Examination" VALUES ("3", "1990-08-01");
INSERT INTO "Examination" VALUES ("3", "1992-03-15");
INSERT INTO "Examination" VALUES ("4", "1992-04-01");
INSERT INTO "Examination" VALUES ("5", "1993-05-01");
INSERT INTO "Examination" VALUES ("6", "1990-07-01");
INSERT INTO "Examination" VALUES ("6", "1991-08-01");
INSERT INTO "Examination" VALUES ("6", "1992-09-01");
INSERT INTO "Examination" VALUES ("6", "1993-10-01");
INSERT INTO "Examination" VALUES ("7", "1989-12-01");
INSERT INTO "Examination" VALUES ("7", "1990-01-01");
INSERT INTO "Examination" VALUES ("8", "1990-01-02");
INSERT INTO "Examination" VALUES ("8", "1994-01-01");
INSERT INTO "Examination" VALUES ("9", "1991-10-01");
INSERT INTO "Examination" VALUES ("10", "1992-06-01");
INSERT INTO "Examination" VALUES ("10", "1993-07-01");
INSERT INTO "Laboratory" VALUES ("1", "1990-02-01");
INSERT INTO "Laboratory" VALUES ("1", "1991-01-01");
INSERT INTO "Laboratory" VALUES ("2", "1991-04-10");
INSERT INTO "Laboratory" VALUES ("3", "1990-08-01");
INSERT INTO "Laboratory" VALUES ("3", "1992-03-15");
INSERT INTO "Laboratory" VALUES ("4", "1992-04-01");
INSERT INTO "Laboratory" VALUES ("5", "1993-05-01");
INSERT INTO "Laboratory" VALUES ("6", "1990-07-01");
INSERT INTO "Laboratory" VALUES ("6", "1991-08-01");
INSERT INTO "Laboratory" VALUES ("6", "1992-09-01");
INSERT INTO "Laboratory" VALUES ("6", "1993-10-01");
INSERT INTO "Laboratory" VALUES ("7", "1990-01-01");
INSERT INTO "Laboratory" VALUES ("8", "1990-01-02");
INSERT INTO "Laboratory" VALUES ("9", "1991-10-01");
INSERT INTO "Laboratory" VALUES ("10", "1992-06-01");
INSERT INTO "Laboratory" VALUES ("10", "1993-07-01");