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 "museum" (
"Museum_ID" INT UNIQUE,
"Open_Year" TEXT,
PRIMARY KEY ("Museum_ID")
);

CREATE TABLE "visit" (
"Museum_ID" INT,
"visitor_ID" TEXT,
PRIMARY KEY ("Museum_ID", "visitor_ID"),
FOREIGN KEY ("visitor_ID") REFERENCES "visitor"("ID")
);

CREATE TABLE "visitor" (
"ID" INT UNIQUE,
"Age" INT,
PRIMARY KEY ("ID")
);





INSERT INTO "museum" VALUES ("1", "2015");
INSERT INTO "museum" VALUES ("2", "2005");
INSERT INTO "museum" VALUES ("3", "2010");
INSERT INTO "museum" VALUES ("4", "2014");
INSERT INTO "museum" VALUES ("5", "2007");
INSERT INTO "museum" VALUES ("6", "2013");
INSERT INTO "museum" VALUES ("7", "2016");
INSERT INTO "museum" VALUES ("8", "2000");
INSERT INTO "visit" VALUES ("1", "101");
INSERT INTO "visit" VALUES ("2", "102");
INSERT INTO "visit" VALUES ("3", "103");
INSERT INTO "visit" VALUES ("4", "104");
INSERT INTO "visit" VALUES ("5", "105");
INSERT INTO "visit" VALUES ("6", "106");
INSERT INTO "visit" VALUES ("7", "107");
INSERT INTO "visit" VALUES ("8", "108");
INSERT INTO "visit" VALUES ("1", "109");
INSERT INTO "visit" VALUES ("2", "110");
INSERT INTO "visitor" VALUES ("101", "30");
INSERT INTO "visitor" VALUES ("102", "25");
INSERT INTO "visitor" VALUES ("103", "40");
INSERT INTO "visitor" VALUES ("104", "22");
INSERT INTO "visitor" VALUES ("105", "50");
INSERT INTO "visitor" VALUES ("106", "35");
INSERT INTO "visitor" VALUES ("107", "28");
INSERT INTO "visitor" VALUES ("108", "60");
INSERT INTO "visitor" VALUES ("109", "18");
INSERT INTO "visitor" VALUES ("110", "45");