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 UNIQUE,
"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,
"Level_of_membership" INT,
PRIMARY KEY ("ID")
);





INSERT INTO "museum" VALUES ("1", "National Art Gallery");
INSERT INTO "museum" VALUES ("2", "History Museum");
INSERT INTO "museum" VALUES ("3", "Science Center");
INSERT INTO "museum" VALUES ("4", "Modern Art Museum");
INSERT INTO "museum" VALUES ("5", "Children's Museum");
INSERT INTO "visitor" VALUES ("101", "1");
INSERT INTO "visitor" VALUES ("102", "2");
INSERT INTO "visitor" VALUES ("103", "3");
INSERT INTO "visitor" VALUES ("104", "1");
INSERT INTO "visitor" VALUES ("105", "2");
INSERT INTO "visitor" VALUES ("106", "3");
INSERT INTO "visitor" VALUES ("107", "1");
INSERT INTO "visitor" VALUES ("108", "2");
INSERT INTO "visitor" VALUES ("109", "3");
INSERT INTO "visitor" VALUES ("110", "1");
INSERT INTO "visit" VALUES ("1", "101", "2", "30.00");
INSERT INTO "visit" VALUES ("1", "102", "5", "75.00");
INSERT INTO "visit" VALUES ("1", "103", "1", "15.00");
INSERT INTO "visit" VALUES ("2", "104", "10", "150.00");
INSERT INTO "visit" VALUES ("2", "105", "3", "45.00");
INSERT INTO "visit" VALUES ("3", "106", "7", "105.00");
INSERT INTO "visit" VALUES ("3", "107", "4", "60.00");
INSERT INTO "visit" VALUES ("4", "108", "15", "225.00");
INSERT INTO "visit" VALUES ("4", "109", "1", "15.00");
INSERT INTO "visit" VALUES ("5", "110", "20", "300.00");
INSERT INTO "visit" VALUES ("5", "101", "2", "30.00");
INSERT INTO "visit" VALUES ("3", "102", "8", "120.00");
INSERT INTO "visit" VALUES ("2", "103", "6", "90.00");
INSERT INTO "visit" VALUES ("1", "104", "3", "45.00");
INSERT INTO "visit" VALUES ("4", "105", "12", "180.00");