29 lines
631 B
PL/PgSQL
29 lines
631 B
PL/PgSQL
BEGIN;
|
|
CREATE TABLE IF NOT EXISTS "pk_fieldingofsplit" (
|
|
"playerID" TEXT,
|
|
"yearID" NUMERIC,
|
|
"stint" NUMERIC,
|
|
"teamID" TEXT,
|
|
"lgID" TEXT,
|
|
"POS" TEXT,
|
|
"G" NUMERIC,
|
|
"GS" NUMERIC,
|
|
"InnOuts" NUMERIC,
|
|
"PO" NUMERIC,
|
|
"A" NUMERIC,
|
|
"E" NUMERIC,
|
|
"DP" NUMERIC,
|
|
"PB" NUMERIC,
|
|
"WP" NUMERIC,
|
|
"SB" NUMERIC,
|
|
"CS" NUMERIC,
|
|
"ZR" NUMERIC,
|
|
PRIMARY KEY("playerID","yearID","stint","teamID","POS"),
|
|
foreign key("playerID") references "people"("playerID")
|
|
);
|
|
|
|
INSERT INTO "pk_fieldingofsplit" SELECT DISTINCT * FROM "fieldingofsplit";
|
|
DROP TABLE "fieldingofsplit";
|
|
ALTER TABLE "pk_fieldingofsplit" RENAME TO "fieldingofsplit";
|
|
COMMIT;
|