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,
"Total_spent" FLOAT,
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", "The Louvre");
INSERT INTO "museum" VALUES ("2", "British Museum");
INSERT INTO "museum" VALUES ("3", "Metropolitan Museum of Art");
INSERT INTO "museum" VALUES ("4", "Smithsonian National Museum of Natural History");
INSERT INTO "museum" VALUES ("5", "Rijksmuseum");
INSERT INTO "museum" VALUES ("6", "Uffizi Gallery");
INSERT INTO "visitor" VALUES ("101", "Alice Smith", "1", "30");
INSERT INTO "visitor" VALUES ("102", "Bob Johnson", "2", "45");
INSERT INTO "visitor" VALUES ("103", "Charlie Brown", "1", "22");
INSERT INTO "visitor" VALUES ("104", "Diana Prince", "3", "50");
INSERT INTO "visitor" VALUES ("105", "Eve Adams", "2", "38");
INSERT INTO "visitor" VALUES ("106", "Frank White", "1", "28");
INSERT INTO "visitor" VALUES ("107", "Grace Lee", "3", "60");
INSERT INTO "visitor" VALUES ("108", "Henry Green", "1", "19");
INSERT INTO "visitor" VALUES ("109", "Ivy Black", "2", "33");
INSERT INTO "visitor" VALUES ("110", "Jack Blue", "1", "41");
INSERT INTO "visit" VALUES ("1", "101", "2", "40.00");
INSERT INTO "visit" VALUES ("1", "102", "1", "20.00");
INSERT INTO "visit" VALUES ("2", "103", "3", "60.00");
INSERT INTO "visit" VALUES ("3", "104", "5", "125.00");
INSERT INTO "visit" VALUES ("4", "105", "2", "50.00");
INSERT INTO "visit" VALUES ("1", "106", "1", "20.00");
INSERT INTO "visit" VALUES ("5", "107", "4", "100.00");
INSERT INTO "visit" VALUES ("2", "108", "1", "20.00");
INSERT INTO "visit" VALUES ("3", "109", "3", "75.00");
INSERT INTO "visit" VALUES ("4", "110", "2", "50.00");
INSERT INTO "visit" VALUES ("1", "104", "6", "120.00");
INSERT INTO "visit" VALUES ("2", "101", "1", "20.00");
INSERT INTO "visit" VALUES ("3", "102", "2", "50.00");
INSERT INTO "visit" VALUES ("4", "103", "1", "25.00");
INSERT INTO "visit" VALUES ("5", "104", "7", "175.00");
INSERT INTO "visit" VALUES ("6", "105", "1", "25.00");
INSERT INTO "visit" VALUES ("1", "107", "8", "160.00");
INSERT INTO "visit" VALUES ("2", "109", "5", "100.00");
INSERT INTO "visit" VALUES ("3", "110", "4", "100.00");
INSERT INTO "visit" VALUES ("4", "106", "3", "75.00");