Learning DB skills with baseball

I mentioned earlier that a perk of the job here at MLB is that we can argue baseball at work, and (sort of) justify it as still being professional (sort of.)

Of course, for THE OFFICIAL DATABASE OF MAJOR LEAGUE BASEBALL, we use a very big professional database on very big professional hardware… but I, myself, am actually fairly bush-league with respect to running a database.  Database machines, I can make purr, but I’m a rookie at creating SQL queries and stuff.

Baseball, though, makes for really fun test data for learning this stuff. If you’re brushing up on your SQL, I heartily recommend getting the baseball table dumps from http://www.baseball-databank.org… they’ll import into MySQL (which I have running here on my workstation), and are a deep well of interesting stuff to dig through and practice with.

Here in the office, based on a request from a mailing list I occasionally browse, we were discussing the heaviest (weighing, not hitting) players from MLB history.

According to my data (unofficial!), congratulations to “Jumbo Brown”, who played from 1925 to 1941 at 295 lbs. (that’s 18 pounds per year.)



mysql> select playerID, nameFirst, nameLast, weight, height from Master where weight > 260 order by weight;

+-----------+-----------+-----------+--------+--------+

| playerID  | nameFirst | nameLast  | weight | height |

+-----------+-----------+-----------+--------+--------+

| judenje01 | Jeff      | Juden     |    265 |   80.0 |

| pickeca01 | Calvin    | Pickering |    275 |   77.0 |

| brownju01 | Jumbo     | Brown     |    295 |   76.0 |

+-----------+-----------+-----------+--------+--------+

3 rows in set (0.27 sec)

One of my guesses, Mo Vaughn, doesn’t even come close to Jumbo, although he does appear to be the heaviest “Vaughn” in the database, at 230 lbs… even beating out “Hippo” Vaughn at 215. 

“Hippo”…Ouch.

mysql> select playerID, nameFirst, nameLast, weight, height from Master where playerID like “%vaugh%”;

+———–+———–+———-+——–+——–+

| playerID  | nameFirst | nameLast | weight | height |

+———–+———–+———-+——–+——–+

| vaughar01 | Arky      | Vaughan  |    175 |   NULL |

| vaughch01 | Charlie   | Vaughan  |    185 |   NULL |

| vaughgl01 | Glenn     | Vaughan  |    170 |   71.0 |

| vaughpo01 | Porter    | Vaughan  |    178 |   73.0 |

| vaughbo01 | Bobby     | Vaughn   |    150 |   69.0 |

| vaughde01 | De Wayne  | Vaughn   |    180 |   71.0 |

| vaughfa01 | Farmer    | Vaughn   |    177 |   75.0 |

| vaughfr01 | Fred      | Vaughn   |    185 |   70.0 |

| vaughgr01 | Greg      | Vaughn   |    193 |   72.0 |

| vaughhi01 | Hippo     | Vaughn   |    215 |   76.0 |

| vaughmo01 | Mo        | Vaughn   |    230 |   73.0 |

| vaughro01 | Roy       | Vaughn   |    178 |   72.0 |

+———–+———–+———-+——–+——–+

12 rows in set (0.09 sec)

–ryan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: