GameDay Database

From Wiki
Jump to: navigation, search

It is a database with info taken from the mlb gameday service (http://gd2.mlb.com/components/game/mlb/) for the 2007 and 2008 seasons including the new pitch f/x data.

To use it you need to have mysql server installed and knowledge of sql language. I also suggest the mysql gui tools download. Or maybe there is something to convert mysql to access database for some people?

I also am providing the vb.net project I used to get the info into the database. Before messing with it, know that I am not a programmer. It is very messy and buggy. I had to run in debug mode to get everything in the database so I think it is not 100% accurate, but it should be good for most researches.

If you do want to work with the project you will need the mysql connector from http://dev.mysql.com/downloads/connector/net/5.2.html to interact with the database.

Here is the link to downloads below.

vb.net project files http://www.mediafire.com/file/nwfnk2vjbm2/gdgrabber.zip

2007-2008 Gameday Database in SQL format http://www.mediafire.com/file/eyqzwmyjy1g/sql_gd_07_08.zip


To put this database on your server you do a command like this:

mysql --user=youruser --password=youpassword < c:\path\to\gd_07_08.sql

To test after you think you have it done use this sample query. It shows k% based on first initial of first name. Weird, I know. I saw an article saying people with names that start with K might strikeout more because of subconcious reasons and I was curious.

Code:

select big.ked / big.tot as kpercent, big.subname1
from ( 
	select *
	from (
		select count(*) as tot, substring(player.fname,1,1) as subname1
		from atbat,player,player_team
		where atbat.batter = player_team.player_team_id
		and player_team.`player$playerid`= player.playerid
		group by substring(player.fname,1,1)) as uno, 
		(
		select count(*) as ked, substring(player.fname,1,1) as subname2
		from atbat,player,player_team
		where atbat.batter = player_team.player_team_id
		and player_team.`player$playerid`= player.playerid
		and atbat.event = 'strikeout'
		group by substring(player.fname,1,1
               )
           ) as dos
      where uno.subname1 = dos.subname2
    ) as big
order by kpercent desc;

External Links[edit]

MLB Gameday database: http://gd2.mlb.com/components/game/mlb/

MySQL vb.net connector: http://dev.mysql.com/downloads/connector/net/5.2.html

Gameday API: http://github.com/timothyf/gameday_api