41 lines
787 B
PL/PgSQL
41 lines
787 B
PL/PgSQL
BEGIN;
|
|
CREATE TABLE IF NOT EXISTS "pk_pitchingpost" (
|
|
"playerID" TEXT,
|
|
"yearID" NUMERIC,
|
|
"round" NUMERIC,
|
|
"teamID" TEXT,
|
|
"lgID" TEXT,
|
|
"W" NUMERIC,
|
|
"L" NUMERIC,
|
|
"G" NUMERIC,
|
|
"GS" NUMERIC,
|
|
"CG" NUMERIC,
|
|
"SHO" NUMERIC,
|
|
"SV" NUMERIC,
|
|
"IPouts" NUMERIC,
|
|
"H" NUMERIC,
|
|
"ER" NUMERIC,
|
|
"HR" NUMERIC,
|
|
"BB" NUMERIC,
|
|
"SO" NUMERIC,
|
|
"BAOpp" NUMERIC,
|
|
"ERA" NUMERIC,
|
|
"IBB" NUMERIC,
|
|
"WP" NUMERIC,
|
|
"HBP" NUMERIC,
|
|
"BK" NUMERIC,
|
|
"BFP" NUMERIC,
|
|
"GF" NUMERIC,
|
|
"R" NUMERIC,
|
|
"SH" NUMERIC,
|
|
"SF" NUMERIC,
|
|
"GIDP" NUMERIC,
|
|
PRIMARY KEY("playerID","yearID","round"),
|
|
foreign key("playerID") references "people"("playerID")
|
|
);
|
|
|
|
INSERT INTO "pk_pitchingpost" SELECT DISTINCT * FROM "pitchingpost";
|
|
DROP TABLE "pitchingpost";
|
|
ALTER TABLE "pk_pitchingpost" RENAME TO "pitchingpost";
|
|
COMMIT;
|