lahmanlite/sql/keys/managers.sql

20 lines
469 B
MySQL
Raw Normal View History

2024-01-26 01:28:46 +00:00
BEGIN;
CREATE TABLE IF NOT EXISTS "pk_managers" (
"playerID" TEXT,
"yearID" NUMERIC,
"teamID" TEXT,
"lgID" TEXT,
"inseason" NUMERIC,
"G" NUMERIC,
"W" NUMERIC,
"L" NUMERIC,
"rank" NUMERIC,
"plyrMgr" TEXT,
2024-01-26 01:49:08 +00:00
PRIMARY KEY("playerID","yearID","teamID","inseason"),
foreign key("playerID") references "people"("playerID")
2024-01-26 01:28:46 +00:00
);
INSERT INTO "pk_managers" SELECT DISTINCT * FROM "managers";
DROP TABLE "managers";
ALTER TABLE "pk_managers" RENAME TO "managers";
COMMIT;