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 "orchestra" (
"Orchestra_ID" INT,
"Orchestra" TEXT,
PRIMARY KEY ("Orchestra_ID")
);

CREATE TABLE "performance" (
"Performance_ID" INT UNIQUE,
"Orchestra_ID" INT,
"Date" TEXT,
PRIMARY KEY ("Performance_ID"),
FOREIGN KEY ("Orchestra_ID") REFERENCES "orchestra"("Orchestra_ID")
);

CREATE TABLE "show" (
"Performance_ID" INT,
"Attendance" FLOAT,
FOREIGN KEY ("Performance_ID") REFERENCES "performance"("Performance_ID")
);





INSERT INTO "orchestra" VALUES ("1", "New York Philharmonic");
INSERT INTO "orchestra" VALUES ("2", "Berlin Philharmonic");
INSERT INTO "orchestra" VALUES ("3", "London Symphony Orchestra");
INSERT INTO "orchestra" VALUES ("4", "Vienna Philharmonic");
INSERT INTO "orchestra" VALUES ("5", "Chicago Symphony Orchestra");
INSERT INTO "performance" VALUES ("101", "1", "2023-01-15");
INSERT INTO "performance" VALUES ("102", "1", "2023-02-20");
INSERT INTO "performance" VALUES ("103", "2", "2023-01-18");
INSERT INTO "performance" VALUES ("104", "2", "2023-03-10");
INSERT INTO "performance" VALUES ("105", "3", "2023-02-25");
INSERT INTO "performance" VALUES ("106", "3", "2023-04-05");
INSERT INTO "performance" VALUES ("107", "4", "2023-01-30");
INSERT INTO "performance" VALUES ("108", "4", "2023-03-15");
INSERT INTO "performance" VALUES ("109", "5", "2023-02-10");
INSERT INTO "performance" VALUES ("110", "5", "2023-04-20");
INSERT INTO "show" VALUES ("101", "1500.0");
INSERT INTO "show" VALUES ("102", "0.0");
INSERT INTO "show" VALUES ("103", "1200.5");
INSERT INTO "show" VALUES ("104", "1300.0");
INSERT INTO "show" VALUES ("105", "800.0");
INSERT INTO "show" VALUES ("106", "950.0");
INSERT INTO "show" VALUES ("107", "2000.0");
INSERT INTO "show" VALUES ("108", "0.0");
INSERT INTO "show" VALUES ("109", "500.0");
INSERT INTO "show" VALUES ("110", "750.0");