lahmanlite/sql/keys/awardsshareplayers.sql

18 lines
498 B
PL/PgSQL

begin;
CREATE TABLE IF NOT EXISTS "pk_awardsshareplayers" (
"awardID" TEXT,
"yearID" NUMERIC,
"lgID" TEXT,
"playerID" TEXT,
"pointsWon" NUMERIC,
"pointsMax" NUMERIC,
"votesFirst" NUMERIC,
PRIMARY KEY("awardID","yearID","playerID","lgID"),
foreign key("playerID") references "people"("playerID")
);
INSERT INTO "pk_awardsshareplayers" SELECT DISTINCT * FROM "awardsshareplayers";
DROP TABLE "awardsshareplayers";
ALTER TABLE "pk_awardsshareplayers" RENAME TO "awardsshareplayers";
commit;