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")
);

CREATE TABLE "visitor" (
"ID" INT UNIQUE,
"Level_of_membership" INT,
"Age" 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", "25");
INSERT INTO "visitor" VALUES ("102", "2", "40");
INSERT INTO "visitor" VALUES ("103", "1", "33");
INSERT INTO "visitor" VALUES ("104", "3", "29");
INSERT INTO "visitor" VALUES ("105", "1", "45");
INSERT INTO "visitor" VALUES ("106", "2", "22");
INSERT INTO "visitor" VALUES ("107", "1", "60");
INSERT INTO "visitor" VALUES ("108", "3", "37");
INSERT INTO "visitor" VALUES ("109", "1", "18");
INSERT INTO "visitor" VALUES ("110", "2", "50");
INSERT INTO "visit" VALUES ("1", "101", "2", "30.00");
INSERT INTO "visit" VALUES ("2", "102", "1", "15.00");
INSERT INTO "visit" VALUES ("3", "103", "3", "45.00");
INSERT INTO "visit" VALUES ("4", "104", "2", "40.00");
INSERT INTO "visit" VALUES ("5", "105", "1", "20.00");
INSERT INTO "visit" VALUES ("1", "106", "4", "60.00");
INSERT INTO "visit" VALUES ("2", "107", "2", "25.00");
INSERT INTO "visit" VALUES ("3", "108", "1", "10.00");
INSERT INTO "visit" VALUES ("4", "109", "5", "75.00");
INSERT INTO "visit" VALUES ("5", "110", "3", "45.00");
INSERT INTO "visit" VALUES ("1", "101", "1", "15.00");
INSERT INTO "visit" VALUES ("3", "103", "2", "30.00");
INSERT INTO "visit" VALUES ("5", "105", "3", "60.00");
INSERT INTO "visit" VALUES ("2", "107", "1", "12.50");
INSERT INTO "visit" VALUES ("4", "109", "1", "15.00");