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,
"First Date" DATE,
PRIMARY KEY ("ID")
);



INSERT INTO "Patient" VALUES ("1", "1980-01-15");
INSERT INTO "Patient" VALUES ("2", "1982-03-20");
INSERT INTO "Patient" VALUES ("3", "1985-07-01");
INSERT INTO "Patient" VALUES ("4", "1990-11-10");
INSERT INTO "Patient" VALUES ("5", "1993-05-25");
INSERT INTO "Patient" VALUES ("6", "1996-02-18");
INSERT INTO "Patient" VALUES ("7", "1988-09-05");
INSERT INTO "Patient" VALUES ("8", "1991-04-12");
INSERT INTO "Patient" VALUES ("9", "1984-12-01");
INSERT INTO "Patient" VALUES ("10", "1995-08-30");
INSERT INTO "Examination" VALUES ("1", "1985-02-01", "Flu");
INSERT INTO "Examination" VALUES ("2", "1986-03-10", "Common Cold");
INSERT INTO "Examination" VALUES ("3", "1987-04-20", "Flu");
INSERT INTO "Examination" VALUES ("4", "1990-12-01", "Pneumonia");
INSERT INTO "Examination" VALUES ("5", "1994-06-15", "Flu");
INSERT INTO "Examination" VALUES ("6", "1996-03-01", "Bronchitis");
INSERT INTO "Examination" VALUES ("7", "1988-10-01", "Common Cold");
INSERT INTO "Examination" VALUES ("8", "1992-05-05", "Flu");
INSERT INTO "Examination" VALUES ("9", "1985-01-05", "Pneumonia");
INSERT INTO "Examination" VALUES ("10", "1995-09-10", "Flu");
INSERT INTO "Examination" VALUES ("1", "1989-07-22", "Common Cold");
INSERT INTO "Examination" VALUES ("3", "1991-02-14", "Pneumonia");
INSERT INTO "Examination" VALUES ("4", "1993-08-01", "Flu");
INSERT INTO "Examination" VALUES ("7", "1995-11-20", "Flu");
INSERT INTO "Examination" VALUES ("9", "1987-06-01", "Common Cold");
INSERT INTO "Laboratory" VALUES ("1", "1985-02-01");
INSERT INTO "Laboratory" VALUES ("2", "1986-03-10");
INSERT INTO "Laboratory" VALUES ("3", "1987-04-20");
INSERT INTO "Laboratory" VALUES ("4", "1990-12-01");
INSERT INTO "Laboratory" VALUES ("5", "1994-06-15");
INSERT INTO "Laboratory" VALUES ("6", "1996-03-01");
INSERT INTO "Laboratory" VALUES ("7", "1988-10-01");
INSERT INTO "Laboratory" VALUES ("8", "1992-05-05");
INSERT INTO "Laboratory" VALUES ("9", "1985-01-05");
INSERT INTO "Laboratory" VALUES ("10", "1995-09-10");
INSERT INTO "Laboratory" VALUES ("1", "1989-07-22");
INSERT INTO "Laboratory" VALUES ("3", "1991-02-14");
INSERT INTO "Laboratory" VALUES ("4", "1993-08-01");
INSERT INTO "Laboratory" VALUES ("7", "1995-11-20");
INSERT INTO "Laboratory" VALUES ("9", "1987-06-01");
INSERT INTO "Laboratory" VALUES ("2", "1984-12-31");
INSERT INTO "Laboratory" VALUES ("5", "1996-01-01");