A09: Lahman’s baseball db
This assignment helps you practice with data import. You will import data from Lahman’s Baseball Database CSV files into MySQL tables.
Create tables to store the information listed below (and no extra info). Your tables must be normalized and include primary keys, foreign keys, and other indexes as appropriate. Also use appropriate column types and meaningful column names rather than the shorthand used in the CSV files. Populate the tables with data from the CSV files. You should import data regarding 17,725 players and 110 teams spanning years 1871-2015. See Lahman’s README.txt for info about the CSV files. The CSV files are available on londo in the directory
/tmp/baseball, which MySQL can access.
Store this information:
- player data: firstname, lastname, birth/death years, weight, height, batting hand (left/right), throwing hand (left/right)
- team data, for every year: name, games played, wins, losses
- batting data: player, year, stint, team, games, at-bats, runs, hits, doubles, triples, homeruns
- pitching data: player, year, stint, team, wins, losses, count of games, hits, walks, strikeouts, batters hit by pitch
Your SQL code should include the table creation and
LOAD DATA commands. Use your own database, e.g.,