lahmanlite/sql/keys/teamshalf.sql

20 lines
395 B
PL/PgSQL

BEGIN;
CREATE TABLE IF NOT EXISTS "pk_teamshalf" (
"yearID" NUMERIC,
"lgID" TEXT,
"teamID" TEXT,
"Half" NUMERIC,
"divID" TEXT,
"DivWin" TEXT,
"Rank" NUMERIC,
"G" NUMERIC,
"W" NUMERIC,
"L" NUMERIC,
PRIMARY KEY("Half","yearID","teamID")
);
INSERT INTO "pk_teamshalf" SELECT DISTINCT * FROM "teamshalf";
DROP TABLE "teamshalf";
ALTER TABLE "pk_teamshalf" RENAME TO "teamshalf";
COMMIT;