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

CREATE TABLE "visit" (
"Museum_ID" INT,
"visitor_ID" TEXT,
"Total_spent" FLOAT,
PRIMARY KEY ("Museum_ID", "visitor_ID")
);

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





INSERT INTO "museum" VALUES ("1", "Plaza Museum", "25", "1998");
INSERT INTO "museum" VALUES ("2", "City Art Gallery", "40", "2005");
INSERT INTO "museum" VALUES ("3", "History House", "15", "1980");
INSERT INTO "museum" VALUES ("4", "Modern Arts Center", "30", "2010");
INSERT INTO "museum" VALUES ("5", "Science World", "50", "1995");
INSERT INTO "visitor" VALUES ("101", "1", "22");
INSERT INTO "visitor" VALUES ("102", "2", "35");
INSERT INTO "visitor" VALUES ("103", "3", "45");
INSERT INTO "visitor" VALUES ("104", "1", "29");
INSERT INTO "visitor" VALUES ("105", "2", "60");
INSERT INTO "visitor" VALUES ("106", "3", "18");
INSERT INTO "visit" VALUES ("1", "101", "120.50");
INSERT INTO "visit" VALUES ("1", "102", "75.00");
INSERT INTO "visit" VALUES ("2", "103", "200.00");
INSERT INTO "visit" VALUES ("3", "104", "50.00");
INSERT INTO "visit" VALUES ("4", "105", "300.00");
INSERT INTO "visit" VALUES ("5", "106", "80.00");
INSERT INTO "visit" VALUES ("1", "105", "60.00");
INSERT INTO "visit" VALUES ("2", "101", "90.00");
INSERT INTO "visit" VALUES ("3", "102", "40.00");
INSERT INTO "visit" VALUES ("4", "103", "110.00");