Get a MySQL Database of Player and Team Statistics

Get a free database of historical baseball data from the Internet (covering every major league game from 1871 through today) in MySQL format.

If you don’t have Microsoft Access (and you don’t want to buy it), or if you are a more experienced database user, you might prefer to use MySQL. The web site http://www.baseball-databank.org offers the same database that the Baseball Archive web site offers, but as a MySQL dump file.

Even if you have Microsoft Access, I recommend that you try MySQL, because it’s faster, more standards compliant, more flexible, and relatively painless once it’s up and running. It’s also easier to use with other software, which is important for many hacks in this book. For instructions on getting MySQL, see “Get and Install MySQL” [Hack #8] . For suggestions on how to make it easier to work with MySQL, see “Get a GUI for MySQL” [Hack #18] . Finally, see “Use SQL to Explore Game Data” [Hack #16] for more information about the SQL language.

After you have MySQL installed, here’s how to get the files and load them into your database.

Step 1: Download the File

You can get the file you need from http://www.Baseball-DataBank.org. From the web site, just download the file labeled “Database in MySQL form” and save it to your local disk. (You can download the 2004 database file from http://www.baseball-databank.org/files/BDB-sql-2005-08-02.sql.zip. Or, you can check for a more current version and use it instead. Just ...

Get Baseball Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.