lahmanlite/sql/keys/awardsplayers.sql

17 lines
437 B
PL/PgSQL

BEGIN;
CREATE TABLE IF NOT EXISTS "pk_awardsplayers" (
"playerID" TEXT,
"awardID" TEXT,
"yearID" NUMERIC,
"lgID" TEXT,
"tie" TEXT,
"notes" TEXT,
PRIMARY KEY("awardID","yearID","lgID","notes","playerID"),
foreign key("playerID") references "people"("playerID")
);
INSERT INTO "pk_awardsplayers" SELECT DISTINCT * FROM "awardsplayers";
DROP TABLE "awardsplayers";
ALTER TABLE "pk_awardsplayers" RENAME TO "awardsplayers";
COMMIT;