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,
"Name" TEXT,
"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", "Alice Johnson", "3", "34");
INSERT INTO "visitor" VALUES ("102", "Bob Smith", "2", "45");
INSERT INTO "visitor" VALUES ("103", "Charlie Lee", "1", "29");
INSERT INTO "visitor" VALUES ("104", "Diana Prince", "4", "38");
INSERT INTO "visitor" VALUES ("105", "Ethan Hunt", "2", "50");
INSERT INTO "visitor" VALUES ("106", "Fiona Glenanne", "3", "41");
INSERT INTO "visitor" VALUES ("107", "George Martin", "1", "60");
INSERT INTO "visitor" VALUES ("108", "Hannah Baker", "4", "22");
INSERT INTO "visit" VALUES ("1", "101", "2", "40.00");
INSERT INTO "visit" VALUES ("2", "101", "1", "15.00");
INSERT INTO "visit" VALUES ("3", "102", "3", "45.00");
INSERT INTO "visit" VALUES ("1", "103", "1", "20.00");
INSERT INTO "visit" VALUES ("4", "104", "5", "125.00");
INSERT INTO "visit" VALUES ("5", "104", "2", "30.00");
INSERT INTO "visit" VALUES ("2", "105", "4", "60.00");
INSERT INTO "visit" VALUES ("3", "106", "2", "30.00");
INSERT INTO "visit" VALUES ("4", "106", "1", "25.00");
INSERT INTO "visit" VALUES ("1", "107", "1", "20.00");
INSERT INTO "visit" VALUES ("5", "108", "6", "90.00");
INSERT INTO "visit" VALUES ("2", "108", "1", "15.00");
INSERT INTO "visit" VALUES ("3", "108", "1", "15.00");
INSERT INTO "visit" VALUES ("4", "108", "1", "25.00");