playground write SQL freely · no grades
SQL Playground
Write SQL against any Runtime dataset. Keep several queries side by side; they're saved in this browser. Nothing here affects course progress.
Ten seasons of Major League Baseball results (2016–2025) with every 2025 player batting line, rosters, ballparks and month-end standings.
99,767 rows7 tables2016-04 – 2025-11
tables
Open a table to see what one row means, its columns and keys, and a preview. Start from games: it is the dataset's central table.
teams31 rows · 6 columns
One MLB team. The Athletics appear twice: Oakland (OAK) through 2024, then Sacramento (ATH) in 2025.
- team_id
Retrosheet team code
- franchise_id
Franchise code; OAK and ATH share one franchise
- city
Home city
- nickname
Club nickname
- league
AL or NL
- division
East, Central or West
venues48 rows · 5 columns
One ballpark that hosted a game, including neutral and international sites.
- venue_id
Retrosheet park code
- venue_name
Park name
- city
City
- region
U.S. state code, or country/territory for sites outside the 50 states
- country
Country or territory
seasons10 rows · 5 columns
One MLB season.
- season
Season year
- first_game_date
Opening day (regular season)
- last_regular_date
Final regular-season date
- games_per_team
Scheduled regular-season games per team (60 in 2020)
- postseason_teams
Clubs qualifying for the postseason
games23,168 rows · 13 columns
One completed regular-season or postseason game.
- game_id
Retrosheet game id: home team, date and game number
- season
Season
- game_date
Local game date
- game_number
0 for a single game, 1 or 2 for doubleheaders
- game_type
regular, playoff (tiebreaker), wildcard, divisionseries, lcs or worldseries
- venue_id
Ballpark
- home_team_id
Home club (last at bat)
- away_team_id
Visiting club
- home_score
Runs scored by the home club
- away_score
Runs scored by the visiting club
- day_night
day or night
- attendance
Paid attendance; NULL when not reported (most 2020 games had no fans)
- duration_minutes
Game time in minutes
players1,471 rows · 9 columns
One player who appeared in a 2025 MLB game.
- player_id
Retrosheet player id
- first_name
Given name
- last_name
Family name
- bats
L, R or B (switch)
- throws
L or R
- primary_position
Position with the most 2025 games (P, C, 1B … DH)
- birth_date
Date of birth
- birth_country
Country of birth
- debut_date
MLB debut date
player_game_stats73,029 rows · 17 columns
One player’s batting stats in one 2025 game. Pitchers usually appear with zero plate appearances.
- game_id
Game
- player_id
Batter
- team_id
Club the player batted for
- batting_order
Lineup slot 1–9; NULL for some substitutes
- started
1 for the starting player in the lineup slot
- plate_appearances
Plate appearances
- at_bats
Official at-bats
- runs
Runs scored
- hits
Hits
- doubles
Doubles
- triples
Triples
- home_runs
Home runs
- rbi
Runs batted in
- walks
Walks (including intentional)
- strikeouts
Strikeouts
- stolen_bases
Stolen bases
- hit_by_pitch
Times hit by a pitch
standings2,010 rows · 7 columns
One team’s win–loss record at the end of a month (and at season end).
- season
Season
- as_of_date
Snapshot date (inclusive)
- team_id
Club
- wins
Wins to date
- losses
Losses to date
- runs_scored
Runs scored to date
- runs_allowed
Runs allowed to date
relationships
How to join these tables. Left column matches the right column.
- games.season joins to seasons.season
- games.venue_id joins to venues.venue_id
- games.home_team_id joins to teams.team_id
- games.away_team_id joins to teams.team_id
- player_game_stats.game_id joins to games.game_id
- player_game_stats.player_id joins to players.player_id
- player_game_stats.team_id joins to teams.team_id
- standings.season joins to seasons.season
- standings.team_id joins to teams.team_id