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

CREATE TABLE "visitor" (
"ID" INT UNIQUE,
"Name" TEXT,
"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", "34");
INSERT INTO "visitor" VALUES ("102", "Bob Smith", "28");
INSERT INTO "visitor" VALUES ("103", "Charlie Lee", "45");
INSERT INTO "visitor" VALUES ("104", "Diana Prince", "22");
INSERT INTO "visitor" VALUES ("105", "Ethan Hunt", "39");
INSERT INTO "visitor" VALUES ("106", "Fiona Glenanne", "31");
INSERT INTO "visitor" VALUES ("107", "George Martin", "50");
INSERT INTO "visitor" VALUES ("108", "Hannah Baker", "19");
INSERT INTO "visit" VALUES ("1", "101", "3", "45.00");
INSERT INTO "visit" VALUES ("2", "102", "5", "75.00");
INSERT INTO "visit" VALUES ("3", "103", "2", "30.00");
INSERT INTO "visit" VALUES ("4", "104", "10", "150.00");
INSERT INTO "visit" VALUES ("5", "105", "1", "15.00");
INSERT INTO "visit" VALUES ("1", "106", "4", "60.00");
INSERT INTO "visit" VALUES ("2", "107", "10", "150.00");
INSERT INTO "visit" VALUES ("3", "108", "7", "105.00");
INSERT INTO "visit" VALUES ("4", "101", "6", "90.00");
INSERT INTO "visit" VALUES ("5", "102", "3", "45.00");