lahmanlite/sql/keys/allstarfull.sql

19 lines
468 B
PL/PgSQL

BEGIN;
CREATE TABLE "pk_allstarfull" (
"playerID" NUMERIC,
"yearID" NUMERIC,
"gameNum" NUMERIC,
"gameID" NUMERIC,
"teamID" NUMERIC,
"lgID" NUMERIC,
"GP" NUMERIC,
"startingPos" NUMERIC,
primary key("playerID","yearID","gameNum","startingPos"),
foreign key("playerID") references "people"("playerID")
);
INSERT INTO "pk_allstarfull" SELECT DISTINCT * FROM "allstarfull";
DROP TABLE "allstarfull";
ALTER TABLE "pk_allstarfull" RENAME TO "allstarfull";
COMMIT;