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 "visit" (
"Museum_ID" INT,
"visitor_ID" TEXT,
"Num_of_Ticket" INT,
PRIMARY KEY ("Museum_ID", "visitor_ID"),
FOREIGN KEY ("visitor_ID") REFERENCES "visitor"("ID")
);

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





INSERT INTO "visitor" VALUES ("1", "1", "25");
INSERT INTO "visitor" VALUES ("2", "2", "35");
INSERT INTO "visitor" VALUES ("3", "1", "20");
INSERT INTO "visitor" VALUES ("4", "3", "40");
INSERT INTO "visitor" VALUES ("5", "1", "29");
INSERT INTO "visitor" VALUES ("6", "2", "30");
INSERT INTO "visitor" VALUES ("7", "1", "18");
INSERT INTO "visitor" VALUES ("8", "3", "50");
INSERT INTO "visitor" VALUES ("9", "2", "22");
INSERT INTO "visitor" VALUES ("10", "1", "28");
INSERT INTO "visit" VALUES ("101", "1", "2");
INSERT INTO "visit" VALUES ("102", "2", "1");
INSERT INTO "visit" VALUES ("103", "3", "3");
INSERT INTO "visit" VALUES ("104", "4", "1");
INSERT INTO "visit" VALUES ("105", "5", "2");
INSERT INTO "visit" VALUES ("101", "6", "1");
INSERT INTO "visit" VALUES ("102", "7", "4");
INSERT INTO "visit" VALUES ("103", "8", "1");
INSERT INTO "visit" VALUES ("104", "9", "2");
INSERT INTO "visit" VALUES ("105", "10", "1");
INSERT INTO "visit" VALUES ("101", "3", "1");
INSERT INTO "visit" VALUES ("102", "5", "2");