##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: TeamOperationsManager
Accessible Columns: team: ALL COLUMNS; manager: ALL COLUMNS; manager_half: ALL COLUMNS; home_game: ALL COLUMNS; park: ALL COLUMNS; postseason: ALL COLUMNS; team_half: ALL COLUMNS; team_franchise: ALL COLUMNS; appearances: year, team_id, player_id, g_all, gs; all_star: year, team_id, player_id, game_num; manager_award: ALL COLUMNS; manager_award_vote: ALL COLUMNS; player: player_id, name_first, name_last, debut, final_game

Based on the above schema and your role's column-level access policy, generate a SQL query to answer the question. If your role does not have access to the required columns, respond with: "Sorry, I cannot answer."


Question: For each year, return the year and the average number of attendance at home games.
Answer: SELECT YEAR ,  avg(attendance) FROM home_game GROUP BY YEAR;
Permission: allowed (All required columns are permitted)
Gold SQL: SELECT YEAR ,  avg(attendance) FROM home_game GROUP BY YEAR;