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,
"Num_of_Staff" INT,
"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")
);

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





INSERT INTO "museum" VALUES ("1", "Plaza Museum", "150", "1998");
INSERT INTO "museum" VALUES ("2", "Art Gallery", "80", "1950");
INSERT INTO "museum" VALUES ("3", "Science Museum", "200", "2005");
INSERT INTO "museum" VALUES ("4", "History Hall", "120", "1970");
INSERT INTO "museum" VALUES ("5", "Children's Museum", "60", "2010");
INSERT INTO "museum" VALUES ("6", "Natural History Museum", "180", "1920");
INSERT INTO "visit" VALUES ("1", "V001", "2", "30.0");
INSERT INTO "visit" VALUES ("1", "V002", "1", "15.0");
INSERT INTO "visit" VALUES ("2", "V003", "3", "45.0");
INSERT INTO "visit" VALUES ("3", "V004", "1", "20.0");
INSERT INTO "visit" VALUES ("4", "V005", "2", "25.0");
INSERT INTO "visit" VALUES ("1", "V006", "4", "60.0");
INSERT INTO "visit" VALUES ("5", "V007", "1", "10.0");
INSERT INTO "visit" VALUES ("2", "V008", "2", "30.0");
INSERT INTO "visit" VALUES ("3", "V009", "3", "60.0");
INSERT INTO "visit" VALUES ("4", "V010", "1", "12.5");
INSERT INTO "visitor" VALUES ("1");
INSERT INTO "visitor" VALUES ("2");
INSERT INTO "visitor" VALUES ("3");
INSERT INTO "visitor" VALUES ("4");
INSERT INTO "visitor" VALUES ("5");
INSERT INTO "visitor" VALUES ("6");
INSERT INTO "visitor" VALUES ("7");
INSERT INTO "visitor" VALUES ("8");
INSERT INTO "visitor" VALUES ("9");
INSERT INTO "visitor" VALUES ("10");