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,
"Name" TEXT,
PRIMARY KEY ("Museum_ID")
);

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

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





INSERT INTO "museum" VALUES ("1", "Louvre");
INSERT INTO "museum" VALUES ("2", "Metropolitan Museum of Art");
INSERT INTO "museum" VALUES ("3", "British Museum");
INSERT INTO "museum" VALUES ("4", "Vatican Museums");
INSERT INTO "museum" VALUES ("5", "State Hermitage Museum");
INSERT INTO "visitor" VALUES ("101", "Alice Johnson", "2", "34");
INSERT INTO "visitor" VALUES ("102", "Bob Smith", "1", "28");
INSERT INTO "visitor" VALUES ("103", "Charlie Lee", "3", "45");
INSERT INTO "visitor" VALUES ("104", "Diana Prince", "2", "22");
INSERT INTO "visitor" VALUES ("105", "Ethan Hunt", "1", "38");
INSERT INTO "visitor" VALUES ("106", "Fiona Gallagher", "3", "29");
INSERT INTO "visit" VALUES ("1", "101", "2");
INSERT INTO "visit" VALUES ("1", "101", "1");
INSERT INTO "visit" VALUES ("2", "101", "1");
INSERT INTO "visit" VALUES ("3", "102", "3");
INSERT INTO "visit" VALUES ("3", "102", "2");
INSERT INTO "visit" VALUES ("4", "103", "1");
INSERT INTO "visit" VALUES ("4", "104", "1");
INSERT INTO "visit" VALUES ("5", "105", "1");
INSERT INTO "visit" VALUES ("5", "105", "1");
INSERT INTO "visit" VALUES ("2", "106", "1");
INSERT INTO "visit" VALUES ("2", "106", "2");
INSERT INTO "visit" VALUES ("2", "106", "1");