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 "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 "visitor" VALUES ("1", "Alice Smith", "3", "30");
INSERT INTO "visitor" VALUES ("2", "Bob Johnson", "2", "45");
INSERT INTO "visitor" VALUES ("3", "Charlie Brown", "1", "22");
INSERT INTO "visitor" VALUES ("4", "Diana Prince", "3", "38");
INSERT INTO "visitor" VALUES ("5", "Eve Adams", "2", "55");
INSERT INTO "visitor" VALUES ("6", "Frank White", "1", "28");
INSERT INTO "visitor" VALUES ("7", "Grace Lee", "3", "40");
INSERT INTO "visitor" VALUES ("8", "Harry Green", "2", "60");
INSERT INTO "visitor" VALUES ("9", "Ivy King", "1", "19");
INSERT INTO "visitor" VALUES ("10", "Jack Black", "3", "35");
INSERT INTO "visitor" VALUES ("11", "Karen Blue", "2", "50");
INSERT INTO "visitor" VALUES ("12", "Liam Red", "1", "25");
INSERT INTO "visit" VALUES ("101", "1", "2", "50.00");
INSERT INTO "visit" VALUES ("102", "1", "1", "25.00");
INSERT INTO "visit" VALUES ("103", "2", "3", "75.00");
INSERT INTO "visit" VALUES ("101", "2", "1", "25.00");
INSERT INTO "visit" VALUES ("104", "3", "1", "20.00");
INSERT INTO "visit" VALUES ("101", "4", "4", "100.00");
INSERT INTO "visit" VALUES ("102", "4", "2", "50.00");
INSERT INTO "visit" VALUES ("103", "5", "2", "60.00");
INSERT INTO "visit" VALUES ("104", "5", "1", "30.00");
INSERT INTO "visit" VALUES ("101", "6", "1", "25.00");
INSERT INTO "visit" VALUES ("102", "7", "3", "75.00");
INSERT INTO "visit" VALUES ("103", "7", "2", "50.00");
INSERT INTO "visit" VALUES ("104", "8", "1", "25.00");
INSERT INTO "visit" VALUES ("101", "9", "1", "20.00");
INSERT INTO "visit" VALUES ("102", "10", "2", "50.00");
INSERT INTO "visit" VALUES ("103", "10", "2", "50.00");
INSERT INTO "visit" VALUES ("104", "11", "3", "75.00");
INSERT INTO "visit" VALUES ("101", "12", "1", "25.00");
INSERT INTO "visit" VALUES ("102", "12", "1", "25.00");
INSERT INTO "visit" VALUES ("103", "1", "1", "25.00");
INSERT INTO "visit" VALUES ("104", "2", "1", "25.00");
INSERT INTO "visit" VALUES ("101", "3", "1", "20.00");
INSERT INTO "visit" VALUES ("102", "6", "1", "25.00");
INSERT INTO "visit" VALUES ("103", "8", "1", "25.00");
INSERT INTO "visit" VALUES ("104", "9", "1", "20.00");
INSERT INTO "visit" VALUES ("101", "11", "1", "25.00");