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

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

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





INSERT INTO "conductor" VALUES ("1", "Leonard Bernstein");
INSERT INTO "conductor" VALUES ("2", "Gustavo Dudamel");
INSERT INTO "conductor" VALUES ("3", "Marin Alsop");
INSERT INTO "conductor" VALUES ("4", "Simon Rattle");
INSERT INTO "conductor" VALUES ("5", "Valery Gergiev");
INSERT INTO "orchestra" VALUES ("101", "1", "1943.0");
INSERT INTO "orchestra" VALUES ("102", "2", "2005.0");
INSERT INTO "orchestra" VALUES ("103", "3", "1999.0");
INSERT INTO "orchestra" VALUES ("104", "4", "1882.0");
INSERT INTO "orchestra" VALUES ("105", "5", "1988.0");
INSERT INTO "orchestra" VALUES ("106", "1", "2010.0");
INSERT INTO "performance" VALUES ("1001", "101", "2023-01-15");
INSERT INTO "performance" VALUES ("1002", "101", "2023-02-20");
INSERT INTO "performance" VALUES ("1003", "102", "2023-03-10");
INSERT INTO "performance" VALUES ("1004", "103", "2023-04-05");
INSERT INTO "performance" VALUES ("1005", "103", "2023-04-20");
INSERT INTO "performance" VALUES ("1006", "104", "2023-05-15");
INSERT INTO "performance" VALUES ("1007", "105", "2023-06-01");
INSERT INTO "performance" VALUES ("1008", "105", "2023-06-15");
INSERT INTO "performance" VALUES ("1009", "105", "2023-07-01");
INSERT INTO "performance" VALUES ("1010", "106", "2023-08-10");