This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP PROCEDURE IF EXISTS std_park_factor_avg; | |
CREATE PROCEDURE std_park_factor_avg() | |
BEGIN | |
DECLARE pit_id CHAR(10); | |
DECLARE lgID CHAR (2); | |
DECLARE YEARID INT; | |
DECLARE gdate DATE; | |
DECLARE seq INT; | |
DECLARE F_park_factor INT; | |
DECLARE RNUMBER INT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP PROCEDURE IF EXISTS starting_pitcher_AL_NL_std_lg_FIP; | |
CREATE PROCEDURE starting_pitcher_AL_NL_std_lg_FIP() | |
BEGIN | |
DECLARE gdate DATE; | |
DECLARE YEARID INT; | |
DECLARE lgID CHAR (2); | |
DECLARE HR INT; | |
DECLARE walks INT; | |
DECLARE HitBP INT; | |
DECLARE K INT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE starting_pitcher_stats ADD COLUMN std_FIPm1 DOUBLE; | |
UPDATE starting_pitcher_stats SET std_FIPm1 = (std_FIP + (std_FIP - (std_FIP*(std_F_parkfactor/100))))/(std_lg_FIP)*100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- function to calculate multi-year FIP for Retrosheet | |
-- This snippet supposes you have the Fangraphs GUTS table located with-in retrosheet. | |
-- Currently calculates career FIP. Just add a year parameter and it works for single season calculations. | |
DELIMITER // | |
CREATE FUNCTION FIP(pitcher VARCHAR(8)) | |
RETURNS DECIMAL(10,2) | |
BEGIN | |
DECLARE FIP DECIMAL(10,2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE starting_pitcher_game_log ADD COLUMN FIP_g DOUBLE; | |
UPDATE starting_pitcher_game_log SET FIP_g = (((HR_a*13)+(3*(walks_a+HBP))-(2*strike_outs))/innings_pitched)+cFIP; |