21 lines
501 B
PL/PgSQL
21 lines
501 B
PL/PgSQL
BEGIN;
|
|
CREATE TABLE IF NOT EXISTS "pk_managershalf" (
|
|
"playerID" TEXT,
|
|
"yearID" NUMERIC,
|
|
"teamID" TEXT,
|
|
"lgID" TEXT,
|
|
"inseason" NUMERIC,
|
|
"half" NUMERIC,
|
|
"G" NUMERIC,
|
|
"W" NUMERIC,
|
|
"L" NUMERIC,
|
|
"rank" NUMERIC,
|
|
PRIMARY KEY("playerID","yearID","teamID","inseason","half"),
|
|
foreign key("playerID") references "people"("playerID")
|
|
);
|
|
|
|
INSERT INTO "pk_managershalf" SELECT DISTINCT * FROM "managershalf";
|
|
DROP TABLE "managershalf";
|
|
ALTER TABLE "pk_managershalf" RENAME TO "managershalf";
|
|
COMMIT;
|