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,
"Num_of_Ticket" INT,
"Total_spent" FLOAT,
PRIMARY KEY ("Museum_ID", "visitor_ID"),
FOREIGN KEY ("Museum_ID") REFERENCES "museum"("Museum_ID")
);





INSERT INTO "museum" VALUES ("101", "The Louvre Museum", "1793");
INSERT INTO "museum" VALUES ("102", "British Museum", "1759");
INSERT INTO "museum" VALUES ("103", "Metropolitan Museum of Art", "1870");
INSERT INTO "museum" VALUES ("104", "Vatican Museums", "1506");
INSERT INTO "museum" VALUES ("105", "Uffizi Gallery", "1581");
INSERT INTO "museum" VALUES ("106", "Rijksmuseum", "1800");
INSERT INTO "museum" VALUES ("107", "Prado Museum", "1819");
INSERT INTO "museum" VALUES ("108", "Hermitage Museum", "1764");
INSERT INTO "museum" VALUES ("109", "National Museum of China", "1912");
INSERT INTO "museum" VALUES ("110", "Smithsonian National Museum of Natural History", "1910");
INSERT INTO "visit" VALUES ("101", "V001", "2", "30.0");
INSERT INTO "visit" VALUES ("101", "V002", "1", "15.0");
INSERT INTO "visit" VALUES ("102", "V003", "3", "45.0");
INSERT INTO "visit" VALUES ("103", "V004", "1", "25.0");
INSERT INTO "visit" VALUES ("104", "V005", "2", "40.0");
INSERT INTO "visit" VALUES ("106", "V006", "1", "20.0");
INSERT INTO "visit" VALUES ("107", "V007", "4", "60.0");
INSERT INTO "visit" VALUES ("109", "V008", "2", "35.0");
INSERT INTO "visit" VALUES ("110", "V009", "1", "10.0");