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 "conductor" (
"Conductor_ID" INT UNIQUE,
"Name" TEXT,
PRIMARY KEY ("Conductor_ID")
);

CREATE TABLE "orchestra" (
"Orchestra_ID" INT UNIQUE,
"Orchestra" TEXT,
"Conductor_ID" INT,
PRIMARY KEY ("Orchestra_ID"),
FOREIGN KEY ("Conductor_ID") REFERENCES "conductor"("Conductor_ID")
);

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





INSERT INTO "conductor" VALUES ("1", "Gustavo Dudamel");
INSERT INTO "conductor" VALUES ("2", "Simon Rattle");
INSERT INTO "conductor" VALUES ("3", "Marin Alsop");
INSERT INTO "conductor" VALUES ("4", "Yannick Nézet-Séguin");
INSERT INTO "conductor" VALUES ("5", "Zubin Mehta");
INSERT INTO "orchestra" VALUES ("101", "Los Angeles Philharmonic", "1");
INSERT INTO "orchestra" VALUES ("102", "Berlin Philharmonic", "2");
INSERT INTO "orchestra" VALUES ("103", "Baltimore Symphony Orchestra", "3");
INSERT INTO "orchestra" VALUES ("104", "Philadelphia Orchestra", "4");
INSERT INTO "orchestra" VALUES ("105", "Israel Philharmonic Orchestra", "5");
INSERT INTO "orchestra" VALUES ("106", "Vienna Philharmonic", "NULL");
INSERT INTO "orchestra" VALUES ("107", "London Symphony Orchestra", "NULL");
INSERT INTO "orchestra" VALUES ("108", "New York Philharmonic", "NULL");
INSERT INTO "performance" VALUES ("1", "101");
INSERT INTO "performance" VALUES ("2", "102");
INSERT INTO "performance" VALUES ("3", "101");
INSERT INTO "performance" VALUES ("4", "104");
INSERT INTO "performance" VALUES ("5", "105");
INSERT INTO "performance" VALUES ("6", "102");
INSERT INTO "performance" VALUES ("7", "103");