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,
"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"),
FOREIGN KEY ("visitor_ID") REFERENCES "visitor"("ID"),
FOREIGN KEY ("Museum_ID") REFERENCES "museum"("Museum_ID")
);

CREATE TABLE "visitor" (
"ID" INT,
"Name" TEXT,
PRIMARY KEY ("ID")
);





INSERT INTO "museum" VALUES ("1", "National Art Gallery", "1950");
INSERT INTO "museum" VALUES ("2", "History Museum", "1975");
INSERT INTO "museum" VALUES ("3", "Science Center", "2000");
INSERT INTO "museum" VALUES ("4", "Modern Art Museum", "2010");
INSERT INTO "museum" VALUES ("5", "Children's Museum", "1995");
INSERT INTO "visitor" VALUES ("101", "Alice Johnson");
INSERT INTO "visitor" VALUES ("102", "Bob Smith");
INSERT INTO "visitor" VALUES ("103", "Charlie Lee");
INSERT INTO "visitor" VALUES ("104", "Diana Prince");
INSERT INTO "visit" VALUES ("1", "101", "25.50");
INSERT INTO "visit" VALUES ("1", "102", "30.00");
INSERT INTO "visit" VALUES ("2", "103", "15.00");
INSERT INTO "visit" VALUES ("3", "104", "40.00");
INSERT INTO "visit" VALUES ("3", "101", "22.00");
INSERT INTO "visit" VALUES ("2", "102", "18.00");