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", "Rijksmuseum");
INSERT INTO "museum" VALUES ("5", "Uffizi Gallery");
INSERT INTO "museum" VALUES ("6", "Smithsonian National Museum of Natural History");
INSERT INTO "museum" VALUES ("7", "Acropolis Museum");
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", "1", "28");
INSERT INTO "visitor" VALUES ("106", "Frank White", "2", "35");
INSERT INTO "visitor" VALUES ("107", "Grace Lee", "1", "60");
INSERT INTO "visitor" VALUES ("108", "Henry Green", "3", "40");
INSERT INTO "visitor" VALUES ("109", "Ivy Black", "1", "18");
INSERT INTO "visitor" VALUES ("110", "Jack Blue", "2", "55");
INSERT INTO "visit" VALUES ("1", "101", "1", "20.00");
INSERT INTO "visit" VALUES ("2", "101", "2", "40.00");
INSERT INTO "visit" VALUES ("1", "102", "1", "25.00");
INSERT INTO "visit" VALUES ("3", "102", "1", "15.00");
INSERT INTO "visit" VALUES ("4", "103", "1", "18.00");
INSERT INTO "visit" VALUES ("5", "104", "2", "50.00");
INSERT INTO "visit" VALUES ("6", "105", "1", "10.00");
INSERT INTO "visit" VALUES ("7", "106", "1", "12.00");
INSERT INTO "visit" VALUES ("1", "107", "1", "20.00");
INSERT INTO "visit" VALUES ("2", "108", "1", "22.00");
INSERT INTO "visit" VALUES ("3", "109", "1", "15.00");
INSERT INTO "visit" VALUES ("4", "110", "1", "18.00");