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





INSERT INTO "museum" VALUES ("1", "National Art Gallery", "50");
INSERT INTO "museum" VALUES ("2", "History Museum", "40");
INSERT INTO "museum" VALUES ("3", "Science Center", "60");
INSERT INTO "museum" VALUES ("4", "Modern Art Museum", "30");
INSERT INTO "museum" VALUES ("5", "Children's Museum", "25");
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.0");
INSERT INTO "visit" VALUES ("1", "102", "1", "15.0");
INSERT INTO "visit" VALUES ("1", "103", "3", "45.0");
INSERT INTO "visit" VALUES ("1", "104", "1", "15.0");
INSERT INTO "visit" VALUES ("1", "105", "2", "30.0");
INSERT INTO "visit" VALUES ("2", "106", "1", "20.0");
INSERT INTO "visit" VALUES ("2", "107", "1", "20.0");
INSERT INTO "visit" VALUES ("2", "108", "1", "20.0");
INSERT INTO "visit" VALUES ("3", "109", "4", "60.0");
INSERT INTO "visit" VALUES ("3", "110", "2", "30.0");
INSERT INTO "visit" VALUES ("3", "101", "1", "15.0");
INSERT INTO "visit" VALUES ("4", "102", "1", "10.0");
INSERT INTO "visit" VALUES ("4", "103", "1", "10.0");
INSERT INTO "visit" VALUES ("5", "104", "3", "25.0");
INSERT INTO "visit" VALUES ("5", "105", "2", "15.0");
INSERT INTO "visit" VALUES ("5", "106", "1", "10.0");
INSERT INTO "visit" VALUES ("5", "107", "1", "10.0");
INSERT INTO "visit" VALUES ("5", "108", "1", "10.0");
INSERT INTO "visit" VALUES ("5", "109", "1", "10.0");
INSERT INTO "visit" VALUES ("5", "110", "1", "10.0");