At bat
In baseball, an at bat (AB) or time at bat is a batter's turn batting against a pitcher. An at bat is different from a plate appearance. A batter is credited with a plate appearance regardless of what happens during their turn at bat, but a batter is credited with an at bat only if that plate appearance does not have one of the results enumerated below. While at bats are used to calculate certain statistics, including batting average and slugging percentage, a player can qualify for the season-ending rankings in these categories only if they accumulate 502 plate appearances during the season.

Batters will not receive credit for an at bat if their plate appearances end under the following circumstances:
 They receive a base on balls (BB).
 They are hit by a pitch (HBP).
 They hit a sacrifice fly or a sacrifice bunt (also known as sacrifice hit).
 They are awarded first base due to interference or obstruction, usually by the catcher.
 They are replaced by another hitter before their at bat is completed, in which case the plate appearance and any related statistics go to the pinch hitter (unless they are replaced with two strikes and their replacement completes a strikeout, in which case the at bat and strikeout are charged to the first batter).
In addition, if the inning ends while they are still at bat (due to the third out being made by a runner caught stealing, for example), no at bat or plate appearance will result.

Put shortly, an at bat is a specific type of plate appearance in which the batter puts the ball in play intending to get on base---it is why at bats, and not plate appearances, are used to calculate batting average, as plate appearances in general can result in many outcomes that don't involve putting the ball in play, and batting average specifically measures a batter's contact hitting.

Rule 9.02(a)(1) of the official rules of Major League Baseball defines an at bat as: "Number of times batted, except that no time at bat shall be charged when a player: (A) hits a sacrifice bunt or sacrifice fly; (B) is awarded first base on four called balls; (C) is hit by a pitched ball; or (D) is awarded first base because of interference or obstruction[.]"

Examples
An at bat is counted when:
The batter reaches first base on a hit
The batter reaches first base on an error
The batter is called out for any reason other than a sacrifice
There is a fielder's choice

Records

Pete Rose had 14,053 career at bats, the all-time major league and National League record. The American League record is held by Carl Yastrzemski, whose 11,988 career at bats were all in the AL.

The single season record is held by Jimmy Rollins, who had 716 at bats in 2007; Willie Wilson, Ichiro Suzuki and Juan Samuel also had more than 700 at bats in a season. 14 players share the single game record of 11 at bats in a single game, all of which were extra inning games. In games of 9 innings or fewer, the record is 7 at bats and has occurred more than 200 times.

The team record for most at bats in a single season is 5,781 by the 1997 Boston Red Sox.

At bat as a phrase
"At bat", "up", "up at bat", and "at the plate" are all phrases describing a batter who is facing the pitcher. Note that just because a player is described as being "at bat" in this sense, he will not necessarily be given an at bat in his statistics; the phrase actually signifies a plate appearance (assuming it is eventually completed). This ambiguous terminology is usually clarified by context. To refer explicitly to a statistical "at bat", the term "official at bat" is sometimes used.

"Time at bat" in the rulebook 
Official Baseball Rule 5.06(c) provides that "[a] batter has legally completed his time at bat when he is put out or becomes a runner" (emphasis added). The "time at bat" defined in this rule is more commonly referred to as a plate appearance, and the playing rules (Rules 1 through 8) uses the phrase "time at bat" in this sense. In contrast, the scoring rules use the phrase "time at bat" to refer to the statistic at bat, defined in Rule 9.02(a)(1), but sometimes uses the phrase "official time at bat" or refers back to Rule 9.02(a)(1) when mentioning the statistic. The phrase "plate appearance" is used in Rules 9.22 and 9.23 dealing with batting titles and hitting streaks, and in Rule 5.10(g) comment regarding the Three-Batter Minimum: "[t]o qualify as one of three consecutive batters, the batter must complete his plate appearance, which ends only when the batter is put out or becomes a runner." The term is not elsewhere defined in the rulebook.

See also
Batting order
At bats with runners in scoring position

Notes

References

Batting statistics
Batting (baseball)