Baseball was invented in 1845 by Alexander Cartwright to provide exercise and entertainment outside of work. A standard game consists of 9 innings with each team batting until they have 3 outs, while 9 defensive positions rotate between innings. The first recorded baseball game was in 1846 between the New York Nine and Knickbockers. Major league baseball now includes teams in both the American and National Leagues, and iconic players from different eras help grow the sport's popularity.