##Instruction:
Database: baseball_1
Total Tables: 26
Total Columns: 352

Table Schemas:

baseball_1 contains tables such as all_star, appearances, manager_award, player_award, manager_award_vote, player_award_vote, batting, batting_postseason, player_college, fielding, fielding_outfield, fielding_postseason, hall_of_fame, home_game, manager, manager_half, player, park, pitching, pitching_postseason, salary, college, postseason, team, team_franchise, team_half.
Table all_star has columns such as player_id, year, game_num, game_id, team_id, league_id, gp, starting_pos.
Table appearances has columns such as year, team_id, league_id, player_id, g_all, gs, g_batting, g_defense, g_p, g_c, g_1b, g_2b, g_3b, g_ss, g_lf, g_cf, g_rf, g_of, g_dh, g_ph, g_pr.
Table manager_award has columns such as player_id, award_id, year, league_id, tie, notes.
Table player_award has columns such as player_id, award_id, year, league_id, tie, notes.
Table manager_award_vote has columns such as award_id, year, league_id, player_id, points_won, points_max, votes_first.
Table player_award_vote has columns such as award_id, year, league_id, player_id, points_won, points_max, votes_first.
Table batting has columns such as player_id, year, stint, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp.
Table batting_postseason has columns such as year, round, player_id, team_id, league_id, g, ab, r, h, double, triple, hr, rbi, sb, cs, bb, so, ibb, hbp, sh, sf, g_idp.
Table player_college has columns such as player_id, college_id, year.
Table fielding has columns such as player_id, year, stint, team_id, league_id, pos, g, gs, inn_outs, po, a, e, dp, pb, wp, sb, cs, zr.
Table fielding_outfield has columns such as player_id, year, stint, glf, gcf, grf.
Table fielding_postseason has columns such as player_id, year, team_id, league_id, round, pos, g, gs, inn_outs, po, a, e, dp, tp, pb, sb, cs.
Table hall_of_fame has columns such as player_id, yearid, votedby, ballots, needed, votes, inducted, category, needed_note.
Table home_game has columns such as year, league_id, team_id, park_id, span_first, span_last, games, openings, attendance.
Table manager has columns such as player_id, year, team_id, league_id, inseason, g, w, l, rank, plyr_mgr.
Table manager_half has columns such as player_id, year, team_id, league_id, inseason, half, g, w, l, rank.
Table player has columns such as player_id, birth_year, birth_month, birth_day, birth_country, birth_state, birth_city, death_year, death_month, death_day, death_country, death_state, death_city, name_first, name_last, name_given, weight, height, bats, throws, debut, final_game, retro_id, bbref_id.
Table park has columns such as park_id, park_name, park_alias, city, state, country.
Table pitching has columns such as player_id, year, stint, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp.
Table pitching_postseason has columns such as player_id, year, round, team_id, league_id, w, l, g, gs, cg, sho, sv, ipouts, h, er, hr, bb, so, baopp, era, ibb, wp, hbp, bk, bfp, gf, r, sh, sf, g_idp.
Table salary has columns such as year, team_id, league_id, player_id, salary.
Table college has columns such as college_id, name_full, city, state, country.
Table postseason has columns such as year, round, team_id_winner, league_id_winner, team_id_loser, league_id_loser, wins, losses, ties.
Table team has columns such as year, league_id, team_id, franchise_id, div_id, rank, g, ghome, w, l, div_win, wc_win, lg_win, ws_win, r, ab, h, double, triple, hr, bb, so, sb, cs, hbp, sf, ra, er, era, cg, sho, sv, ipouts, ha, hra, bba, soa, e, dp, fp, name, park, attendance, bpf, ppf, team_id_br, team_id_lahman45, team_id_retro.
Table team_franchise has columns such as franchise_id, franchise_name, active, na_assoc.
Table team_half has columns such as year, league_id, team_id, half, div_id, div_win, rank, g, w, l.
The player_id of all_star is the foreign key of player_id of player.
The player_id of appearances is the foreign key of player_id of player.
The team_id of appearances is the foreign key of team_id of team.
The player_id of manager_award is the foreign key of player_id of player.
The player_id of player_award is the foreign key of player_id of player.
The player_id of player_award_vote is the foreign key of player_id of player.
The player_id of batting is the foreign key of player_id of player.
The team_id of batting_postseason is the foreign key of team_id of team.
The player_id of batting_postseason is the foreign key of player_id of player.
The college_id of player_college is the foreign key of college_id of college.
The player_id of player_college is the foreign key of player_id of player.
The player_id of fielding is the foreign key of player_id of player.
The player_id of fielding_outfield is the foreign key of player_id of player.
The player_id of fielding_postseason is the foreign key of player_id of player.
The player_id of hall_of_fame is the foreign key of player_id of player.
The park_id of home_game is the foreign key of park_id of park.
The team_id of home_game is the foreign key of team_id of team.
The team_id of manager is the foreign key of team_id of team.
The team_id of manager_half is the foreign key of team_id of team.

##Role Access Policy (Column-Level):
Role: DataOperator_3
Accessible Columns:
  - all_star: * (all columns)
  - appearances: * (all columns)
  - batting: * (all columns)
  - batting_postseason: cs, double, g, hr, league_id, r, rbi, round, sb, sf, sh, so, year
  - college: college_id, name_full, state
  - fielding: a, cs, dp, e, g, league_id, pb, player_id, po, pos, sb, stint, wp, year, zr
  - fielding_outfield: * (all columns)
  - fielding_postseason: * (all columns)
  - hall_of_fame: * (all columns)
  - home_game: * (all columns)
  - manager: * (all columns)
  - manager_award: award_id, notes, tie, year
  - manager_award_vote: * (all columns)
  - manager_half: * (all columns)
  - park: * (all columns)
  - pitching: baopp, bb, bfp, er, era, gf, gs, h, hbp, hr, ibb, ipouts, league_id, player_id, r, sf, sh, stint, team_id
  - pitching_postseason: bb, bk, cg, er, g, g_idp, gf, gs, hbp, ibb, ipouts, l, league_id, player_id, r, sh, so, sv, team_id, w, year
  - player: bats, bbref_id, birth_city, birth_country, birth_day, birth_month, birth_year, death_month, death_year, debut, final_game, name_first, name_given, name_last, player_id, retro_id
  - player_award: * (all columns)
  - player_award_vote: award_id, league_id, points_max, votes_first, year
  - player_college: player_id, year
  - postseason: * (all columns)
  - salary: * (all columns)
  - team: * (all columns)
  - team_franchise: active, franchise_name
  - team_half: div_id, div_win, g, l, league_id, team_id, w, year

Question: Find the id and rank of the team that has the highest average attendance rate in 2014.
Answer: SELECT T2.team_id ,  T2.rank FROM home_game AS T1 JOIN team AS T2 ON T1.team_id  =  T2.team_id WHERE T1.year  =  2014 GROUP BY T1.team_id ORDER BY avg(T1.attendance) DESC LIMIT 1;
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT T2.team_id ,  T2.rank FROM home_game AS T1 JOIN team AS T2 ON T1.team_id  =  T2.team_id WHERE T1.year  =  2014 GROUP BY T1.team_id ORDER BY avg(T1.attendance) DESC LIMIT 1;