Input:
[INST] Here is a database schema:
all_star :
player_id [ TEXT ] all_star.player_id = player.player_id
year [ INT ]
game_num [ INT ]
game_id [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
gp [ INT ]
starting_pos [ INT ]

appearances :
year [ INT ]
team_id [ TEXT ] appearances.team_id = team.team_id
league_id [ TEXT ]
player_id [ TEXT ] appearances.player_id = player.player_id
g_all [ INT ]
gs [ INT ]
g_batting [ INT ]
g_defense [ INT ]
g_p [ INT ]
g_c [ INT ]
g_1b [ INT ]
g_2b [ INT ]
g_3b [ INT ]
g_ss [ INT ]
g_lf [ INT ]
g_cf [ INT ]
g_rf [ INT ]
g_of [ INT ]
g_dh [ INT ]
g_ph [ INT ]
g_pr [ INT ]

manager_award :
player_id [ TEXT ] manager_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ INT ]

player_award :
player_id [ TEXT ] player_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ TEXT ]

manager_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ]
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

player_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ] player_award_vote.player_id = player.player_id
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

batting :
player_id [ TEXT ] batting.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

batting_postseason :
year [ INT ]
round [ TEXT ]
player_id [ TEXT ] batting_postseason.player_id = player.player_id
team_id [ TEXT ] batting_postseason.team_id = team.team_id
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

player_college :
player_id [ TEXT ] player_college.player_id = player.player_id
college_id [ TEXT ] player_college.college_id = college.college_id
year [ INT ]

fielding :
player_id [ TEXT ] fielding.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
pb [ INT ]
wp [ INT ]
sb [ INT ]
cs [ INT ]
zr [ INT ]

fielding_outfield :
player_id [ TEXT ] fielding_outfield.player_id = player.player_id
year [ INT ]
stint [ INT ]
glf [ INT ]
gcf [ INT ]
grf [ INT ]

fielding_postseason :
player_id [ TEXT ] fielding_postseason.player_id = player.player_id
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
round [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
tp [ INT ]
pb [ INT ]
sb [ INT ]
cs [ INT ]

hall_of_fame :
player_id [ TEXT ] hall_of_fame.player_id = player.player_id
yearid [ INT ]
votedby [ TEXT ]
ballots [ INT ]
needed [ INT ]
votes [ INT ]
inducted [ TEXT ]
category [ TEXT ]
needed_note [ TEXT ]

home_game :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ] home_game.team_id = team.team_id
park_id [ TEXT ] home_game.park_id = park.park_id
span_first [ TEXT ]
span_last [ TEXT ]
games [ INT ]
openings [ INT ]
attendance [ INT ]

manager :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]
plyr_mgr [ TEXT ]

manager_half :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager_half.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
half [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]

player :
player_id [ TEXT ]
birth_year [ INT ]
birth_month [ INT ]
birth_day [ INT ]
birth_country [ TEXT ]
birth_state [ TEXT ]
birth_city [ TEXT ]
death_year [ INT ]
death_month [ INT ]
death_day [ INT ]
death_country [ TEXT ]
death_state [ TEXT ]
death_city [ TEXT ]
name_first [ TEXT ]
name_last [ TEXT ]
name_given [ TEXT ]
weight [ INT ]
height [ INT ]
bats [ TEXT ]
throws [ TEXT ]
debut [ TEXT ]
final_game [ TEXT ]
retro_id [ TEXT ]
bbref_id [ TEXT ]

park :
park_id [ TEXT ]
park_name [ TEXT ]
park_alias [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

pitching :
player_id [ TEXT ]
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ INT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

pitching_postseason :
player_id [ TEXT ]
year [ INT ]
round [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ TEXT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

salary :
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
player_id [ TEXT ]
salary [ INT ]

college :
college_id [ TEXT ]
name_full [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

postseason :
year [ INT ]
round [ TEXT ]
team_id_winner [ TEXT ]
league_id_winner [ TEXT ]
team_id_loser [ TEXT ]
league_id_loser [ TEXT ]
wins [ INT ]
losses [ INT ]
ties [ INT ]

team :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
franchise_id [ TEXT ]
div_id [ TEXT ]
rank [ INT ]
g [ INT ]
ghome [ INT ]
w [ INT ]
l [ INT ]
div_win [ TEXT ]
wc_win [ TEXT ]
lg_win [ TEXT ]
ws_win [ TEXT ]
r [ INT ]
ab [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
sb [ INT ]
cs [ INT ]
hbp [ INT ]
sf [ INT ]
ra [ INT ]
er [ INT ]
era [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
ha [ INT ]
hra [ INT ]
bba [ INT ]
soa [ INT ]
e [ INT ]
dp [ INT ]
fp [ INT ]
name [ TEXT ]
park [ TEXT ]
attendance [ INT ]
bpf [ INT ]
ppf [ INT ]
team_id_br [ TEXT ]
team_id_lahman45 [ TEXT ]
team_id_retro [ TEXT ]

team_franchise :
franchise_id [ TEXT ]
franchise_name [ TEXT ]
active [ TEXT ]
na_assoc [ TEXT ]

team_half :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
half [ INT ]
div_id [ TEXT ]
div_win [ TEXT ]
rank [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]

Please write me a SQL statement that answers the following question: Find the team that attended the least number of home games in 1980. [/INST]

Output: SELECT T2.name FROM home_game AS T1 JOIN team AS T2 ON T1.team_id = T2.team_id_br WHERE T1.year = 1980 ORDER BY T1.attendance ASC LIMIT 1;


Input:
[INST] Here is a database schema:
all_star :
player_id [ TEXT ] all_star.player_id = player.player_id
year [ INT ]
game_num [ INT ]
game_id [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
gp [ INT ]
starting_pos [ INT ]

appearances :
year [ INT ]
team_id [ TEXT ] appearances.team_id = team.team_id
league_id [ TEXT ]
player_id [ TEXT ] appearances.player_id = player.player_id
g_all [ INT ]
gs [ INT ]
g_batting [ INT ]
g_defense [ INT ]
g_p [ INT ]
g_c [ INT ]
g_1b [ INT ]
g_2b [ INT ]
g_3b [ INT ]
g_ss [ INT ]
g_lf [ INT ]
g_cf [ INT ]
g_rf [ INT ]
g_of [ INT ]
g_dh [ INT ]
g_ph [ INT ]
g_pr [ INT ]

manager_award :
player_id [ TEXT ] manager_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ INT ]

player_award :
player_id [ TEXT ] player_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ TEXT ]

manager_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ]
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

player_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ] player_award_vote.player_id = player.player_id
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

batting :
player_id [ TEXT ] batting.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

batting_postseason :
year [ INT ]
round [ TEXT ]
player_id [ TEXT ] batting_postseason.player_id = player.player_id
team_id [ TEXT ] batting_postseason.team_id = team.team_id
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

player_college :
player_id [ TEXT ] player_college.player_id = player.player_id
college_id [ TEXT ] player_college.college_id = college.college_id
year [ INT ]

fielding :
player_id [ TEXT ] fielding.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
pb [ INT ]
wp [ INT ]
sb [ INT ]
cs [ INT ]
zr [ INT ]

fielding_outfield :
player_id [ TEXT ] fielding_outfield.player_id = player.player_id
year [ INT ]
stint [ INT ]
glf [ INT ]
gcf [ INT ]
grf [ INT ]

fielding_postseason :
player_id [ TEXT ] fielding_postseason.player_id = player.player_id
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
round [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
tp [ INT ]
pb [ INT ]
sb [ INT ]
cs [ INT ]

hall_of_fame :
player_id [ TEXT ] hall_of_fame.player_id = player.player_id
yearid [ INT ]
votedby [ TEXT ]
ballots [ INT ]
needed [ INT ]
votes [ INT ]
inducted [ TEXT ]
category [ TEXT ]
needed_note [ TEXT ]

home_game :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ] home_game.team_id = team.team_id
park_id [ TEXT ] home_game.park_id = park.park_id
span_first [ TEXT ]
span_last [ TEXT ]
games [ INT ]
openings [ INT ]
attendance [ INT ]

manager :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]
plyr_mgr [ TEXT ]

manager_half :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager_half.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
half [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]

player :
player_id [ TEXT ]
birth_year [ INT ]
birth_month [ INT ]
birth_day [ INT ]
birth_country [ TEXT ]
birth_state [ TEXT ]
birth_city [ TEXT ]
death_year [ INT ]
death_month [ INT ]
death_day [ INT ]
death_country [ TEXT ]
death_state [ TEXT ]
death_city [ TEXT ]
name_first [ TEXT ]
name_last [ TEXT ]
name_given [ TEXT ]
weight [ INT ]
height [ INT ]
bats [ TEXT ]
throws [ TEXT ]
debut [ TEXT ]
final_game [ TEXT ]
retro_id [ TEXT ]
bbref_id [ TEXT ]

park :
park_id [ TEXT ]
park_name [ TEXT ]
park_alias [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

pitching :
player_id [ TEXT ]
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ INT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

pitching_postseason :
player_id [ TEXT ]
year [ INT ]
round [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ TEXT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

salary :
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
player_id [ TEXT ]
salary [ INT ]

college :
college_id [ TEXT ]
name_full [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

postseason :
year [ INT ]
round [ TEXT ]
team_id_winner [ TEXT ]
league_id_winner [ TEXT ]
team_id_loser [ TEXT ]
league_id_loser [ TEXT ]
wins [ INT ]
losses [ INT ]
ties [ INT ]

team :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
franchise_id [ TEXT ]
div_id [ TEXT ]
rank [ INT ]
g [ INT ]
ghome [ INT ]
w [ INT ]
l [ INT ]
div_win [ TEXT ]
wc_win [ TEXT ]
lg_win [ TEXT ]
ws_win [ TEXT ]
r [ INT ]
ab [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
sb [ INT ]
cs [ INT ]
hbp [ INT ]
sf [ INT ]
ra [ INT ]
er [ INT ]
era [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
ha [ INT ]
hra [ INT ]
bba [ INT ]
soa [ INT ]
e [ INT ]
dp [ INT ]
fp [ INT ]
name [ TEXT ]
park [ TEXT ]
attendance [ INT ]
bpf [ INT ]
ppf [ INT ]
team_id_br [ TEXT ]
team_id_lahman45 [ TEXT ]
team_id_retro [ TEXT ]

team_franchise :
franchise_id [ TEXT ]
franchise_name [ TEXT ]
active [ TEXT ]
na_assoc [ TEXT ]

team_half :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
half [ INT ]
div_id [ TEXT ]
div_win [ TEXT ]
rank [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]

Please write me a SQL statement that answers the following question: List the names of states that have more than 2 parks. [/INST]

Output: SELECT state FROM park GROUP BY state HAVING count(*)  >  2;


Input:
[INST] Here is a database schema:
all_star :
player_id [ TEXT ] all_star.player_id = player.player_id
year [ INT ]
game_num [ INT ]
game_id [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
gp [ INT ]
starting_pos [ INT ]

appearances :
year [ INT ]
team_id [ TEXT ] appearances.team_id = team.team_id
league_id [ TEXT ]
player_id [ TEXT ] appearances.player_id = player.player_id
g_all [ INT ]
gs [ INT ]
g_batting [ INT ]
g_defense [ INT ]
g_p [ INT ]
g_c [ INT ]
g_1b [ INT ]
g_2b [ INT ]
g_3b [ INT ]
g_ss [ INT ]
g_lf [ INT ]
g_cf [ INT ]
g_rf [ INT ]
g_of [ INT ]
g_dh [ INT ]
g_ph [ INT ]
g_pr [ INT ]

manager_award :
player_id [ TEXT ] manager_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ INT ]

player_award :
player_id [ TEXT ] player_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ TEXT ]

manager_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ]
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

player_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ] player_award_vote.player_id = player.player_id
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

batting :
player_id [ TEXT ] batting.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

batting_postseason :
year [ INT ]
round [ TEXT ]
player_id [ TEXT ] batting_postseason.player_id = player.player_id
team_id [ TEXT ] batting_postseason.team_id = team.team_id
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

player_college :
player_id [ TEXT ] player_college.player_id = player.player_id
college_id [ TEXT ] player_college.college_id = college.college_id
year [ INT ]

fielding :
player_id [ TEXT ] fielding.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
pb [ INT ]
wp [ INT ]
sb [ INT ]
cs [ INT ]
zr [ INT ]

fielding_outfield :
player_id [ TEXT ] fielding_outfield.player_id = player.player_id
year [ INT ]
stint [ INT ]
glf [ INT ]
gcf [ INT ]
grf [ INT ]

fielding_postseason :
player_id [ TEXT ] fielding_postseason.player_id = player.player_id
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
round [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
tp [ INT ]
pb [ INT ]
sb [ INT ]
cs [ INT ]

hall_of_fame :
player_id [ TEXT ] hall_of_fame.player_id = player.player_id
yearid [ INT ]
votedby [ TEXT ]
ballots [ INT ]
needed [ INT ]
votes [ INT ]
inducted [ TEXT ]
category [ TEXT ]
needed_note [ TEXT ]

home_game :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ] home_game.team_id = team.team_id
park_id [ TEXT ] home_game.park_id = park.park_id
span_first [ TEXT ]
span_last [ TEXT ]
games [ INT ]
openings [ INT ]
attendance [ INT ]

manager :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]
plyr_mgr [ TEXT ]

manager_half :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager_half.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
half [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]

player :
player_id [ TEXT ]
birth_year [ INT ]
birth_month [ INT ]
birth_day [ INT ]
birth_country [ TEXT ]
birth_state [ TEXT ]
birth_city [ TEXT ]
death_year [ INT ]
death_month [ INT ]
death_day [ INT ]
death_country [ TEXT ]
death_state [ TEXT ]
death_city [ TEXT ]
name_first [ TEXT ]
name_last [ TEXT ]
name_given [ TEXT ]
weight [ INT ]
height [ INT ]
bats [ TEXT ]
throws [ TEXT ]
debut [ TEXT ]
final_game [ TEXT ]
retro_id [ TEXT ]
bbref_id [ TEXT ]

park :
park_id [ TEXT ]
park_name [ TEXT ]
park_alias [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

pitching :
player_id [ TEXT ]
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ INT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

pitching_postseason :
player_id [ TEXT ]
year [ INT ]
round [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ TEXT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

salary :
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
player_id [ TEXT ]
salary [ INT ]

college :
college_id [ TEXT ]
name_full [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

postseason :
year [ INT ]
round [ TEXT ]
team_id_winner [ TEXT ]
league_id_winner [ TEXT ]
team_id_loser [ TEXT ]
league_id_loser [ TEXT ]
wins [ INT ]
losses [ INT ]
ties [ INT ]

team :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
franchise_id [ TEXT ]
div_id [ TEXT ]
rank [ INT ]
g [ INT ]
ghome [ INT ]
w [ INT ]
l [ INT ]
div_win [ TEXT ]
wc_win [ TEXT ]
lg_win [ TEXT ]
ws_win [ TEXT ]
r [ INT ]
ab [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
sb [ INT ]
cs [ INT ]
hbp [ INT ]
sf [ INT ]
ra [ INT ]
er [ INT ]
era [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
ha [ INT ]
hra [ INT ]
bba [ INT ]
soa [ INT ]
e [ INT ]
dp [ INT ]
fp [ INT ]
name [ TEXT ]
park [ TEXT ]
attendance [ INT ]
bpf [ INT ]
ppf [ INT ]
team_id_br [ TEXT ]
team_id_lahman45 [ TEXT ]
team_id_retro [ TEXT ]

team_franchise :
franchise_id [ TEXT ]
franchise_name [ TEXT ]
active [ TEXT ]
na_assoc [ TEXT ]

team_half :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
half [ INT ]
div_id [ TEXT ]
div_win [ TEXT ]
rank [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]

Please write me a SQL statement that answers the following question: Which states have more than 2 parks? [/INST]

Output: SELECT state FROM park GROUP BY state HAVING count(*)  >  2;


Input:
[INST] Here is a database schema:
all_star :
player_id [ TEXT ] all_star.player_id = player.player_id
year [ INT ]
game_num [ INT ]
game_id [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
gp [ INT ]
starting_pos [ INT ]

appearances :
year [ INT ]
team_id [ TEXT ] appearances.team_id = team.team_id
league_id [ TEXT ]
player_id [ TEXT ] appearances.player_id = player.player_id
g_all [ INT ]
gs [ INT ]
g_batting [ INT ]
g_defense [ INT ]
g_p [ INT ]
g_c [ INT ]
g_1b [ INT ]
g_2b [ INT ]
g_3b [ INT ]
g_ss [ INT ]
g_lf [ INT ]
g_cf [ INT ]
g_rf [ INT ]
g_of [ INT ]
g_dh [ INT ]
g_ph [ INT ]
g_pr [ INT ]

manager_award :
player_id [ TEXT ] manager_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ INT ]

player_award :
player_id [ TEXT ] player_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ TEXT ]

manager_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ]
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

player_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ] player_award_vote.player_id = player.player_id
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

batting :
player_id [ TEXT ] batting.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

batting_postseason :
year [ INT ]
round [ TEXT ]
player_id [ TEXT ] batting_postseason.player_id = player.player_id
team_id [ TEXT ] batting_postseason.team_id = team.team_id
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

player_college :
player_id [ TEXT ] player_college.player_id = player.player_id
college_id [ TEXT ] player_college.college_id = college.college_id
year [ INT ]

fielding :
player_id [ TEXT ] fielding.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
pb [ INT ]
wp [ INT ]
sb [ INT ]
cs [ INT ]
zr [ INT ]

fielding_outfield :
player_id [ TEXT ] fielding_outfield.player_id = player.player_id
year [ INT ]
stint [ INT ]
glf [ INT ]
gcf [ INT ]
grf [ INT ]

fielding_postseason :
player_id [ TEXT ] fielding_postseason.player_id = player.player_id
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
round [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
tp [ INT ]
pb [ INT ]
sb [ INT ]
cs [ INT ]

hall_of_fame :
player_id [ TEXT ] hall_of_fame.player_id = player.player_id
yearid [ INT ]
votedby [ TEXT ]
ballots [ INT ]
needed [ INT ]
votes [ INT ]
inducted [ TEXT ]
category [ TEXT ]
needed_note [ TEXT ]

home_game :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ] home_game.team_id = team.team_id
park_id [ TEXT ] home_game.park_id = park.park_id
span_first [ TEXT ]
span_last [ TEXT ]
games [ INT ]
openings [ INT ]
attendance [ INT ]

manager :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]
plyr_mgr [ TEXT ]

manager_half :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager_half.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
half [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]

player :
player_id [ TEXT ]
birth_year [ INT ]
birth_month [ INT ]
birth_day [ INT ]
birth_country [ TEXT ]
birth_state [ TEXT ]
birth_city [ TEXT ]
death_year [ INT ]
death_month [ INT ]
death_day [ INT ]
death_country [ TEXT ]
death_state [ TEXT ]
death_city [ TEXT ]
name_first [ TEXT ]
name_last [ TEXT ]
name_given [ TEXT ]
weight [ INT ]
height [ INT ]
bats [ TEXT ]
throws [ TEXT ]
debut [ TEXT ]
final_game [ TEXT ]
retro_id [ TEXT ]
bbref_id [ TEXT ]

park :
park_id [ TEXT ]
park_name [ TEXT ]
park_alias [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

pitching :
player_id [ TEXT ]
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ INT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

pitching_postseason :
player_id [ TEXT ]
year [ INT ]
round [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ TEXT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

salary :
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
player_id [ TEXT ]
salary [ INT ]

college :
college_id [ TEXT ]
name_full [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

postseason :
year [ INT ]
round [ TEXT ]
team_id_winner [ TEXT ]
league_id_winner [ TEXT ]
team_id_loser [ TEXT ]
league_id_loser [ TEXT ]
wins [ INT ]
losses [ INT ]
ties [ INT ]

team :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
franchise_id [ TEXT ]
div_id [ TEXT ]
rank [ INT ]
g [ INT ]
ghome [ INT ]
w [ INT ]
l [ INT ]
div_win [ TEXT ]
wc_win [ TEXT ]
lg_win [ TEXT ]
ws_win [ TEXT ]
r [ INT ]
ab [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
sb [ INT ]
cs [ INT ]
hbp [ INT ]
sf [ INT ]
ra [ INT ]
er [ INT ]
era [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
ha [ INT ]
hra [ INT ]
bba [ INT ]
soa [ INT ]
e [ INT ]
dp [ INT ]
fp [ INT ]
name [ TEXT ]
park [ TEXT ]
attendance [ INT ]
bpf [ INT ]
ppf [ INT ]
team_id_br [ TEXT ]
team_id_lahman45 [ TEXT ]
team_id_retro [ TEXT ]

team_franchise :
franchise_id [ TEXT ]
franchise_name [ TEXT ]
active [ TEXT ]
na_assoc [ TEXT ]

team_half :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
half [ INT ]
div_id [ TEXT ]
div_win [ TEXT ]
rank [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]

Please write me a SQL statement that answers the following question: How many team franchises are active, with active value 'Y'? [/INST]

Output: SELECT count(*) FROM team_franchise WHERE active = 'Y';


Input:
[INST] Here is a database schema:
all_star :
player_id [ TEXT ] all_star.player_id = player.player_id
year [ INT ]
game_num [ INT ]
game_id [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
gp [ INT ]
starting_pos [ INT ]

appearances :
year [ INT ]
team_id [ TEXT ] appearances.team_id = team.team_id
league_id [ TEXT ]
player_id [ TEXT ] appearances.player_id = player.player_id
g_all [ INT ]
gs [ INT ]
g_batting [ INT ]
g_defense [ INT ]
g_p [ INT ]
g_c [ INT ]
g_1b [ INT ]
g_2b [ INT ]
g_3b [ INT ]
g_ss [ INT ]
g_lf [ INT ]
g_cf [ INT ]
g_rf [ INT ]
g_of [ INT ]
g_dh [ INT ]
g_ph [ INT ]
g_pr [ INT ]

manager_award :
player_id [ TEXT ] manager_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ INT ]

player_award :
player_id [ TEXT ] player_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ TEXT ]

manager_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ]
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

player_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ] player_award_vote.player_id = player.player_id
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

batting :
player_id [ TEXT ] batting.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

batting_postseason :
year [ INT ]
round [ TEXT ]
player_id [ TEXT ] batting_postseason.player_id = player.player_id
team_id [ TEXT ] batting_postseason.team_id = team.team_id
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

player_college :
player_id [ TEXT ] player_college.player_id = player.player_id
college_id [ TEXT ] player_college.college_id = college.college_id
year [ INT ]

fielding :
player_id [ TEXT ] fielding.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
pb [ INT ]
wp [ INT ]
sb [ INT ]
cs [ INT ]
zr [ INT ]

fielding_outfield :
player_id [ TEXT ] fielding_outfield.player_id = player.player_id
year [ INT ]
stint [ INT ]
glf [ INT ]
gcf [ INT ]
grf [ INT ]

fielding_postseason :
player_id [ TEXT ] fielding_postseason.player_id = player.player_id
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
round [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
tp [ INT ]
pb [ INT ]
sb [ INT ]
cs [ INT ]

hall_of_fame :
player_id [ TEXT ] hall_of_fame.player_id = player.player_id
yearid [ INT ]
votedby [ TEXT ]
ballots [ INT ]
needed [ INT ]
votes [ INT ]
inducted [ TEXT ]
category [ TEXT ]
needed_note [ TEXT ]

home_game :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ] home_game.team_id = team.team_id
park_id [ TEXT ] home_game.park_id = park.park_id
span_first [ TEXT ]
span_last [ TEXT ]
games [ INT ]
openings [ INT ]
attendance [ INT ]

manager :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]
plyr_mgr [ TEXT ]

manager_half :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager_half.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
half [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]

player :
player_id [ TEXT ]
birth_year [ INT ]
birth_month [ INT ]
birth_day [ INT ]
birth_country [ TEXT ]
birth_state [ TEXT ]
birth_city [ TEXT ]
death_year [ INT ]
death_month [ INT ]
death_day [ INT ]
death_country [ TEXT ]
death_state [ TEXT ]
death_city [ TEXT ]
name_first [ TEXT ]
name_last [ TEXT ]
name_given [ TEXT ]
weight [ INT ]
height [ INT ]
bats [ TEXT ]
throws [ TEXT ]
debut [ TEXT ]
final_game [ TEXT ]
retro_id [ TEXT ]
bbref_id [ TEXT ]

park :
park_id [ TEXT ]
park_name [ TEXT ]
park_alias [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

pitching :
player_id [ TEXT ]
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ INT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

pitching_postseason :
player_id [ TEXT ]
year [ INT ]
round [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ TEXT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

salary :
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
player_id [ TEXT ]
salary [ INT ]

college :
college_id [ TEXT ]
name_full [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

postseason :
year [ INT ]
round [ TEXT ]
team_id_winner [ TEXT ]
league_id_winner [ TEXT ]
team_id_loser [ TEXT ]
league_id_loser [ TEXT ]
wins [ INT ]
losses [ INT ]
ties [ INT ]

team :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
franchise_id [ TEXT ]
div_id [ TEXT ]
rank [ INT ]
g [ INT ]
ghome [ INT ]
w [ INT ]
l [ INT ]
div_win [ TEXT ]
wc_win [ TEXT ]
lg_win [ TEXT ]
ws_win [ TEXT ]
r [ INT ]
ab [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
sb [ INT ]
cs [ INT ]
hbp [ INT ]
sf [ INT ]
ra [ INT ]
er [ INT ]
era [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
ha [ INT ]
hra [ INT ]
bba [ INT ]
soa [ INT ]
e [ INT ]
dp [ INT ]
fp [ INT ]
name [ TEXT ]
park [ TEXT ]
attendance [ INT ]
bpf [ INT ]
ppf [ INT ]
team_id_br [ TEXT ]
team_id_lahman45 [ TEXT ]
team_id_retro [ TEXT ]

team_franchise :
franchise_id [ TEXT ]
franchise_name [ TEXT ]
active [ TEXT ]
na_assoc [ TEXT ]

team_half :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
half [ INT ]
div_id [ TEXT ]
div_win [ TEXT ]
rank [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]

Please write me a SQL statement that answers the following question: Find the number of team franchises that are active (have 'Y' as "active" information). [/INST]

Output: SELECT count(*) FROM team_franchise WHERE active = 'Y';


Input:
[INST] Here is a database schema:
all_star :
player_id [ TEXT ] all_star.player_id = player.player_id
year [ INT ]
game_num [ INT ]
game_id [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
gp [ INT ]
starting_pos [ INT ]

appearances :
year [ INT ]
team_id [ TEXT ] appearances.team_id = team.team_id
league_id [ TEXT ]
player_id [ TEXT ] appearances.player_id = player.player_id
g_all [ INT ]
gs [ INT ]
g_batting [ INT ]
g_defense [ INT ]
g_p [ INT ]
g_c [ INT ]
g_1b [ INT ]
g_2b [ INT ]
g_3b [ INT ]
g_ss [ INT ]
g_lf [ INT ]
g_cf [ INT ]
g_rf [ INT ]
g_of [ INT ]
g_dh [ INT ]
g_ph [ INT ]
g_pr [ INT ]

manager_award :
player_id [ TEXT ] manager_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ INT ]

player_award :
player_id [ TEXT ] player_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ TEXT ]

manager_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ]
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

player_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ] player_award_vote.player_id = player.player_id
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

batting :
player_id [ TEXT ] batting.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

batting_postseason :
year [ INT ]
round [ TEXT ]
player_id [ TEXT ] batting_postseason.player_id = player.player_id
team_id [ TEXT ] batting_postseason.team_id = team.team_id
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

player_college :
player_id [ TEXT ] player_college.player_id = player.player_id
college_id [ TEXT ] player_college.college_id = college.college_id
year [ INT ]

fielding :
player_id [ TEXT ] fielding.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
pb [ INT ]
wp [ INT ]
sb [ INT ]
cs [ INT ]
zr [ INT ]

fielding_outfield :
player_id [ TEXT ] fielding_outfield.player_id = player.player_id
year [ INT ]
stint [ INT ]
glf [ INT ]
gcf [ INT ]
grf [ INT ]

fielding_postseason :
player_id [ TEXT ] fielding_postseason.player_id = player.player_id
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
round [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
tp [ INT ]
pb [ INT ]
sb [ INT ]
cs [ INT ]

hall_of_fame :
player_id [ TEXT ] hall_of_fame.player_id = player.player_id
yearid [ INT ]
votedby [ TEXT ]
ballots [ INT ]
needed [ INT ]
votes [ INT ]
inducted [ TEXT ]
category [ TEXT ]
needed_note [ TEXT ]

home_game :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ] home_game.team_id = team.team_id
park_id [ TEXT ] home_game.park_id = park.park_id
span_first [ TEXT ]
span_last [ TEXT ]
games [ INT ]
openings [ INT ]
attendance [ INT ]

manager :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]
plyr_mgr [ TEXT ]

manager_half :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager_half.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
half [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]

player :
player_id [ TEXT ]
birth_year [ INT ]
birth_month [ INT ]
birth_day [ INT ]
birth_country [ TEXT ]
birth_state [ TEXT ]
birth_city [ TEXT ]
death_year [ INT ]
death_month [ INT ]
death_day [ INT ]
death_country [ TEXT ]
death_state [ TEXT ]
death_city [ TEXT ]
name_first [ TEXT ]
name_last [ TEXT ]
name_given [ TEXT ]
weight [ INT ]
height [ INT ]
bats [ TEXT ]
throws [ TEXT ]
debut [ TEXT ]
final_game [ TEXT ]
retro_id [ TEXT ]
bbref_id [ TEXT ]

park :
park_id [ TEXT ]
park_name [ TEXT ]
park_alias [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

pitching :
player_id [ TEXT ]
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ INT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

pitching_postseason :
player_id [ TEXT ]
year [ INT ]
round [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ TEXT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

salary :
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
player_id [ TEXT ]
salary [ INT ]

college :
college_id [ TEXT ]
name_full [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

postseason :
year [ INT ]
round [ TEXT ]
team_id_winner [ TEXT ]
league_id_winner [ TEXT ]
team_id_loser [ TEXT ]
league_id_loser [ TEXT ]
wins [ INT ]
losses [ INT ]
ties [ INT ]

team :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
franchise_id [ TEXT ]
div_id [ TEXT ]
rank [ INT ]
g [ INT ]
ghome [ INT ]
w [ INT ]
l [ INT ]
div_win [ TEXT ]
wc_win [ TEXT ]
lg_win [ TEXT ]
ws_win [ TEXT ]
r [ INT ]
ab [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
sb [ INT ]
cs [ INT ]
hbp [ INT ]
sf [ INT ]
ra [ INT ]
er [ INT ]
era [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
ha [ INT ]
hra [ INT ]
bba [ INT ]
soa [ INT ]
e [ INT ]
dp [ INT ]
fp [ INT ]
name [ TEXT ]
park [ TEXT ]
attendance [ INT ]
bpf [ INT ]
ppf [ INT ]
team_id_br [ TEXT ]
team_id_lahman45 [ TEXT ]
team_id_retro [ TEXT ]

team_franchise :
franchise_id [ TEXT ]
franchise_name [ TEXT ]
active [ TEXT ]
na_assoc [ TEXT ]

team_half :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
half [ INT ]
div_id [ TEXT ]
div_win [ TEXT ]
rank [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]

Please write me a SQL statement that answers the following question: Which cities have 2 to 4 parks? [/INST]

Output: SELECT city FROM park GROUP BY city HAVING count(*) BETWEEN 2 AND 4;


Input:
[INST] Here is a database schema:
all_star :
player_id [ TEXT ] all_star.player_id = player.player_id
year [ INT ]
game_num [ INT ]
game_id [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
gp [ INT ]
starting_pos [ INT ]

appearances :
year [ INT ]
team_id [ TEXT ] appearances.team_id = team.team_id
league_id [ TEXT ]
player_id [ TEXT ] appearances.player_id = player.player_id
g_all [ INT ]
gs [ INT ]
g_batting [ INT ]
g_defense [ INT ]
g_p [ INT ]
g_c [ INT ]
g_1b [ INT ]
g_2b [ INT ]
g_3b [ INT ]
g_ss [ INT ]
g_lf [ INT ]
g_cf [ INT ]
g_rf [ INT ]
g_of [ INT ]
g_dh [ INT ]
g_ph [ INT ]
g_pr [ INT ]

manager_award :
player_id [ TEXT ] manager_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ INT ]

player_award :
player_id [ TEXT ] player_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ TEXT ]

manager_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ]
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

player_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ] player_award_vote.player_id = player.player_id
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

batting :
player_id [ TEXT ] batting.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

batting_postseason :
year [ INT ]
round [ TEXT ]
player_id [ TEXT ] batting_postseason.player_id = player.player_id
team_id [ TEXT ] batting_postseason.team_id = team.team_id
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

player_college :
player_id [ TEXT ] player_college.player_id = player.player_id
college_id [ TEXT ] player_college.college_id = college.college_id
year [ INT ]

fielding :
player_id [ TEXT ] fielding.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
pb [ INT ]
wp [ INT ]
sb [ INT ]
cs [ INT ]
zr [ INT ]

fielding_outfield :
player_id [ TEXT ] fielding_outfield.player_id = player.player_id
year [ INT ]
stint [ INT ]
glf [ INT ]
gcf [ INT ]
grf [ INT ]

fielding_postseason :
player_id [ TEXT ] fielding_postseason.player_id = player.player_id
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
round [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
tp [ INT ]
pb [ INT ]
sb [ INT ]
cs [ INT ]

hall_of_fame :
player_id [ TEXT ] hall_of_fame.player_id = player.player_id
yearid [ INT ]
votedby [ TEXT ]
ballots [ INT ]
needed [ INT ]
votes [ INT ]
inducted [ TEXT ]
category [ TEXT ]
needed_note [ TEXT ]

home_game :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ] home_game.team_id = team.team_id
park_id [ TEXT ] home_game.park_id = park.park_id
span_first [ TEXT ]
span_last [ TEXT ]
games [ INT ]
openings [ INT ]
attendance [ INT ]

manager :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]
plyr_mgr [ TEXT ]

manager_half :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager_half.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
half [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]

player :
player_id [ TEXT ]
birth_year [ INT ]
birth_month [ INT ]
birth_day [ INT ]
birth_country [ TEXT ]
birth_state [ TEXT ]
birth_city [ TEXT ]
death_year [ INT ]
death_month [ INT ]
death_day [ INT ]
death_country [ TEXT ]
death_state [ TEXT ]
death_city [ TEXT ]
name_first [ TEXT ]
name_last [ TEXT ]
name_given [ TEXT ]
weight [ INT ]
height [ INT ]
bats [ TEXT ]
throws [ TEXT ]
debut [ TEXT ]
final_game [ TEXT ]
retro_id [ TEXT ]
bbref_id [ TEXT ]

park :
park_id [ TEXT ]
park_name [ TEXT ]
park_alias [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

pitching :
player_id [ TEXT ]
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ INT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

pitching_postseason :
player_id [ TEXT ]
year [ INT ]
round [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ TEXT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

salary :
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
player_id [ TEXT ]
salary [ INT ]

college :
college_id [ TEXT ]
name_full [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

postseason :
year [ INT ]
round [ TEXT ]
team_id_winner [ TEXT ]
league_id_winner [ TEXT ]
team_id_loser [ TEXT ]
league_id_loser [ TEXT ]
wins [ INT ]
losses [ INT ]
ties [ INT ]

team :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
franchise_id [ TEXT ]
div_id [ TEXT ]
rank [ INT ]
g [ INT ]
ghome [ INT ]
w [ INT ]
l [ INT ]
div_win [ TEXT ]
wc_win [ TEXT ]
lg_win [ TEXT ]
ws_win [ TEXT ]
r [ INT ]
ab [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
sb [ INT ]
cs [ INT ]
hbp [ INT ]
sf [ INT ]
ra [ INT ]
er [ INT ]
era [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
ha [ INT ]
hra [ INT ]
bba [ INT ]
soa [ INT ]
e [ INT ]
dp [ INT ]
fp [ INT ]
name [ TEXT ]
park [ TEXT ]
attendance [ INT ]
bpf [ INT ]
ppf [ INT ]
team_id_br [ TEXT ]
team_id_lahman45 [ TEXT ]
team_id_retro [ TEXT ]

team_franchise :
franchise_id [ TEXT ]
franchise_name [ TEXT ]
active [ TEXT ]
na_assoc [ TEXT ]

team_half :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
half [ INT ]
div_id [ TEXT ]
div_win [ TEXT ]
rank [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]

Please write me a SQL statement that answers the following question: Find all the cities that have 2 to 4 parks. [/INST]

Output: SELECT city FROM park GROUP BY city HAVING count(*) BETWEEN 2 AND 4;


Input:
[INST] Here is a database schema:
all_star :
player_id [ TEXT ] all_star.player_id = player.player_id
year [ INT ]
game_num [ INT ]
game_id [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
gp [ INT ]
starting_pos [ INT ]

appearances :
year [ INT ]
team_id [ TEXT ] appearances.team_id = team.team_id
league_id [ TEXT ]
player_id [ TEXT ] appearances.player_id = player.player_id
g_all [ INT ]
gs [ INT ]
g_batting [ INT ]
g_defense [ INT ]
g_p [ INT ]
g_c [ INT ]
g_1b [ INT ]
g_2b [ INT ]
g_3b [ INT ]
g_ss [ INT ]
g_lf [ INT ]
g_cf [ INT ]
g_rf [ INT ]
g_of [ INT ]
g_dh [ INT ]
g_ph [ INT ]
g_pr [ INT ]

manager_award :
player_id [ TEXT ] manager_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ INT ]

player_award :
player_id [ TEXT ] player_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ TEXT ]

manager_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ]
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

player_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ] player_award_vote.player_id = player.player_id
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

batting :
player_id [ TEXT ] batting.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

batting_postseason :
year [ INT ]
round [ TEXT ]
player_id [ TEXT ] batting_postseason.player_id = player.player_id
team_id [ TEXT ] batting_postseason.team_id = team.team_id
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

player_college :
player_id [ TEXT ] player_college.player_id = player.player_id
college_id [ TEXT ] player_college.college_id = college.college_id
year [ INT ]

fielding :
player_id [ TEXT ] fielding.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
pb [ INT ]
wp [ INT ]
sb [ INT ]
cs [ INT ]
zr [ INT ]

fielding_outfield :
player_id [ TEXT ] fielding_outfield.player_id = player.player_id
year [ INT ]
stint [ INT ]
glf [ INT ]
gcf [ INT ]
grf [ INT ]

fielding_postseason :
player_id [ TEXT ] fielding_postseason.player_id = player.player_id
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
round [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
tp [ INT ]
pb [ INT ]
sb [ INT ]
cs [ INT ]

hall_of_fame :
player_id [ TEXT ] hall_of_fame.player_id = player.player_id
yearid [ INT ]
votedby [ TEXT ]
ballots [ INT ]
needed [ INT ]
votes [ INT ]
inducted [ TEXT ]
category [ TEXT ]
needed_note [ TEXT ]

home_game :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ] home_game.team_id = team.team_id
park_id [ TEXT ] home_game.park_id = park.park_id
span_first [ TEXT ]
span_last [ TEXT ]
games [ INT ]
openings [ INT ]
attendance [ INT ]

manager :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]
plyr_mgr [ TEXT ]

manager_half :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager_half.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
half [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]

player :
player_id [ TEXT ]
birth_year [ INT ]
birth_month [ INT ]
birth_day [ INT ]
birth_country [ TEXT ]
birth_state [ TEXT ]
birth_city [ TEXT ]
death_year [ INT ]
death_month [ INT ]
death_day [ INT ]
death_country [ TEXT ]
death_state [ TEXT ]
death_city [ TEXT ]
name_first [ TEXT ]
name_last [ TEXT ]
name_given [ TEXT ]
weight [ INT ]
height [ INT ]
bats [ TEXT ]
throws [ TEXT ]
debut [ TEXT ]
final_game [ TEXT ]
retro_id [ TEXT ]
bbref_id [ TEXT ]

park :
park_id [ TEXT ]
park_name [ TEXT ]
park_alias [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

pitching :
player_id [ TEXT ]
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ INT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

pitching_postseason :
player_id [ TEXT ]
year [ INT ]
round [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ TEXT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

salary :
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
player_id [ TEXT ]
salary [ INT ]

college :
college_id [ TEXT ]
name_full [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

postseason :
year [ INT ]
round [ TEXT ]
team_id_winner [ TEXT ]
league_id_winner [ TEXT ]
team_id_loser [ TEXT ]
league_id_loser [ TEXT ]
wins [ INT ]
losses [ INT ]
ties [ INT ]

team :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
franchise_id [ TEXT ]
div_id [ TEXT ]
rank [ INT ]
g [ INT ]
ghome [ INT ]
w [ INT ]
l [ INT ]
div_win [ TEXT ]
wc_win [ TEXT ]
lg_win [ TEXT ]
ws_win [ TEXT ]
r [ INT ]
ab [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
sb [ INT ]
cs [ INT ]
hbp [ INT ]
sf [ INT ]
ra [ INT ]
er [ INT ]
era [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
ha [ INT ]
hra [ INT ]
bba [ INT ]
soa [ INT ]
e [ INT ]
dp [ INT ]
fp [ INT ]
name [ TEXT ]
park [ TEXT ]
attendance [ INT ]
bpf [ INT ]
ppf [ INT ]
team_id_br [ TEXT ]
team_id_lahman45 [ TEXT ]
team_id_retro [ TEXT ]

team_franchise :
franchise_id [ TEXT ]
franchise_name [ TEXT ]
active [ TEXT ]
na_assoc [ TEXT ]

team_half :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
half [ INT ]
div_id [ TEXT ]
div_win [ TEXT ]
rank [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]

Please write me a SQL statement that answers the following question: Which park had most attendances in 2008? [/INST]

Output: SELECT T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id  =  T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC LIMIT 1;


Input:
[INST] Here is a database schema:
all_star :
player_id [ TEXT ] all_star.player_id = player.player_id
year [ INT ]
game_num [ INT ]
game_id [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
gp [ INT ]
starting_pos [ INT ]

appearances :
year [ INT ]
team_id [ TEXT ] appearances.team_id = team.team_id
league_id [ TEXT ]
player_id [ TEXT ] appearances.player_id = player.player_id
g_all [ INT ]
gs [ INT ]
g_batting [ INT ]
g_defense [ INT ]
g_p [ INT ]
g_c [ INT ]
g_1b [ INT ]
g_2b [ INT ]
g_3b [ INT ]
g_ss [ INT ]
g_lf [ INT ]
g_cf [ INT ]
g_rf [ INT ]
g_of [ INT ]
g_dh [ INT ]
g_ph [ INT ]
g_pr [ INT ]

manager_award :
player_id [ TEXT ] manager_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ INT ]

player_award :
player_id [ TEXT ] player_award.player_id = player.player_id
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
tie [ TEXT ]
notes [ TEXT ]

manager_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ]
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

player_award_vote :
award_id [ TEXT ]
year [ INT ]
league_id [ TEXT ]
player_id [ TEXT ] player_award_vote.player_id = player.player_id
points_won [ INT ]
points_max [ INT ]
votes_first [ INT ]

batting :
player_id [ TEXT ] batting.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

batting_postseason :
year [ INT ]
round [ TEXT ]
player_id [ TEXT ] batting_postseason.player_id = player.player_id
team_id [ TEXT ] batting_postseason.team_id = team.team_id
league_id [ TEXT ]
g [ INT ]
ab [ INT ]
r [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
rbi [ INT ]
sb [ INT ]
cs [ INT ]
bb [ INT ]
so [ INT ]
ibb [ INT ]
hbp [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

player_college :
player_id [ TEXT ] player_college.player_id = player.player_id
college_id [ TEXT ] player_college.college_id = college.college_id
year [ INT ]

fielding :
player_id [ TEXT ] fielding.player_id = player.player_id
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
pb [ INT ]
wp [ INT ]
sb [ INT ]
cs [ INT ]
zr [ INT ]

fielding_outfield :
player_id [ TEXT ] fielding_outfield.player_id = player.player_id
year [ INT ]
stint [ INT ]
glf [ INT ]
gcf [ INT ]
grf [ INT ]

fielding_postseason :
player_id [ TEXT ] fielding_postseason.player_id = player.player_id
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
round [ TEXT ]
pos [ TEXT ]
g [ INT ]
gs [ INT ]
inn_outs [ INT ]
po [ INT ]
a [ INT ]
e [ INT ]
dp [ INT ]
tp [ INT ]
pb [ INT ]
sb [ INT ]
cs [ INT ]

hall_of_fame :
player_id [ TEXT ] hall_of_fame.player_id = player.player_id
yearid [ INT ]
votedby [ TEXT ]
ballots [ INT ]
needed [ INT ]
votes [ INT ]
inducted [ TEXT ]
category [ TEXT ]
needed_note [ TEXT ]

home_game :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ] home_game.team_id = team.team_id
park_id [ TEXT ] home_game.park_id = park.park_id
span_first [ TEXT ]
span_last [ TEXT ]
games [ INT ]
openings [ INT ]
attendance [ INT ]

manager :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]
plyr_mgr [ TEXT ]

manager_half :
player_id [ TEXT ]
year [ INT ]
team_id [ TEXT ] manager_half.team_id = team.team_id
league_id [ TEXT ]
inseason [ INT ]
half [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]
rank [ INT ]

player :
player_id [ TEXT ]
birth_year [ INT ]
birth_month [ INT ]
birth_day [ INT ]
birth_country [ TEXT ]
birth_state [ TEXT ]
birth_city [ TEXT ]
death_year [ INT ]
death_month [ INT ]
death_day [ INT ]
death_country [ TEXT ]
death_state [ TEXT ]
death_city [ TEXT ]
name_first [ TEXT ]
name_last [ TEXT ]
name_given [ TEXT ]
weight [ INT ]
height [ INT ]
bats [ TEXT ]
throws [ TEXT ]
debut [ TEXT ]
final_game [ TEXT ]
retro_id [ TEXT ]
bbref_id [ TEXT ]

park :
park_id [ TEXT ]
park_name [ TEXT ]
park_alias [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

pitching :
player_id [ TEXT ]
year [ INT ]
stint [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ INT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

pitching_postseason :
player_id [ TEXT ]
year [ INT ]
round [ TEXT ]
team_id [ TEXT ]
league_id [ TEXT ]
w [ INT ]
l [ INT ]
g [ INT ]
gs [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
h [ INT ]
er [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
baopp [ TEXT ]
era [ INT ]
ibb [ INT ]
wp [ INT ]
hbp [ INT ]
bk [ INT ]
bfp [ INT ]
gf [ INT ]
r [ INT ]
sh [ INT ]
sf [ INT ]
g_idp [ INT ]

salary :
year [ INT ]
team_id [ TEXT ]
league_id [ TEXT ]
player_id [ TEXT ]
salary [ INT ]

college :
college_id [ TEXT ]
name_full [ TEXT ]
city [ TEXT ]
state [ TEXT ]
country [ TEXT ]

postseason :
year [ INT ]
round [ TEXT ]
team_id_winner [ TEXT ]
league_id_winner [ TEXT ]
team_id_loser [ TEXT ]
league_id_loser [ TEXT ]
wins [ INT ]
losses [ INT ]
ties [ INT ]

team :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
franchise_id [ TEXT ]
div_id [ TEXT ]
rank [ INT ]
g [ INT ]
ghome [ INT ]
w [ INT ]
l [ INT ]
div_win [ TEXT ]
wc_win [ TEXT ]
lg_win [ TEXT ]
ws_win [ TEXT ]
r [ INT ]
ab [ INT ]
h [ INT ]
double [ INT ]
triple [ INT ]
hr [ INT ]
bb [ INT ]
so [ INT ]
sb [ INT ]
cs [ INT ]
hbp [ INT ]
sf [ INT ]
ra [ INT ]
er [ INT ]
era [ INT ]
cg [ INT ]
sho [ INT ]
sv [ INT ]
ipouts [ INT ]
ha [ INT ]
hra [ INT ]
bba [ INT ]
soa [ INT ]
e [ INT ]
dp [ INT ]
fp [ INT ]
name [ TEXT ]
park [ TEXT ]
attendance [ INT ]
bpf [ INT ]
ppf [ INT ]
team_id_br [ TEXT ]
team_id_lahman45 [ TEXT ]
team_id_retro [ TEXT ]

team_franchise :
franchise_id [ TEXT ]
franchise_name [ TEXT ]
active [ TEXT ]
na_assoc [ TEXT ]

team_half :
year [ INT ]
league_id [ TEXT ]
team_id [ TEXT ]
half [ INT ]
div_id [ TEXT ]
div_win [ TEXT ]
rank [ INT ]
g [ INT ]
w [ INT ]
l [ INT ]

Please write me a SQL statement that answers the following question: Which park did the most people attend in 2008? [/INST]

Output: SELECT T2.park_name FROM home_game AS T1 JOIN park AS T2 ON T1.park_id  =  T2.park_id WHERE T1.year = 2008 ORDER BY T1.attendance DESC LIMIT 1;


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: How many camera lenses have a focal length longer than 15 mm? [/INST]

Output: SELECT count(*) FROM camera_lens WHERE focal_length_mm  >  15;


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: Find the brand and name for each camera lens, and sort in descending order of maximum aperture. [/INST]

Output: SELECT brand ,  name FROM camera_lens ORDER BY max_aperture DESC;


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: List the id, color scheme, and name for all the photos. [/INST]

Output: SELECT id ,  color ,  name FROM photos;


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: What are the maximum and average height of the mountains? [/INST]

Output: SELECT max(height) ,  avg(height) FROM mountain;


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: What are the average prominence of the mountains in country 'Morocco'? [/INST]

Output: SELECT avg(prominence) FROM mountain WHERE country  =  'Morocco';


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: What are the name, height and prominence of mountains which do not belong to the range 'Aberdare Range'? [/INST]

Output: SELECT name ,  height ,  prominence FROM mountain WHERE range != 'Aberdare Range';


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: What are the id and name of the photos for mountains? [/INST]

Output: SELECT T1.id ,  T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id  =  T2.mountain_id WHERE T1.height  >  4000;


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: What are the id and name of the mountains that have at least 2 photos? [/INST]

Output: SELECT T1.id ,  T1.name FROM mountain AS T1 JOIN photos AS T2 ON T1.id  =  T2.mountain_id GROUP BY T1.id HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of the cameras that have taken picture of the most mountains? [/INST]

Output: SELECT T2.name FROM photos AS T1 JOIN camera_lens AS T2 ON T1.camera_lens_id  =  T2.id GROUP BY T2.id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of photos taken with the lens brand 'Sigma' or 'Olympus'? [/INST]

Output: SELECT T1.name FROM camera_lens AS T1 JOIN photos AS T2 ON T2.camera_lens_id  =  T1.id WHERE T1.brand  =  'Sigma' OR T1.brand  =  'Olympus';


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: How many different kinds of lens brands are there? [/INST]

Output: SELECT count(DISTINCT brand) FROM camera_lens;


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: How many camera lenses are not used in taking any photos? [/INST]

Output: SELECT count(*) FROM camera_lens WHERE id NOT IN ( SELECT camera_lens_id FROM photos );


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: How many distinct kinds of camera lenses are used to take photos of mountains in the country 'Ethiopia'? [/INST]

Output: SELECT count(DISTINCT T2.camera_lens_id) FROM mountain AS T1 JOIN photos AS T2 ON T1.id  =  T2.mountain_id WHERE T1.country  =  'Ethiopia';


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: List the brands of lenses that took both a picture of mountains with range 'Toubkal Atlas' and a picture of mountains with range 'Lasta Massif' [/INST]

Output: SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id  =  T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id  =  T3.id WHERE T1.range  =  'Toubkal Atlas' INTERSECT SELECT T3.brand FROM mountain AS T1 JOIN photos AS T2 ON T1.id  =  T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id  =  T3.id WHERE T1.range  =  'Lasta Massif';


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: Show the name and prominence of the mountains whose picture is not taken by a lens of brand 'Sigma'. [/INST]

Output: SELECT name ,  prominence FROM mountain EXCEPT SELECT T1.name ,  T1.prominence FROM mountain AS T1 JOIN photos AS T2 ON T1.id  =  T2.mountain_id JOIN camera_lens AS T3 ON T2.camera_lens_id  =  T3.id WHERE T3.brand  =  'Sigma';


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: List the camera lens names containing substring "Digital". [/INST]

Output: SELECT name FROM camera_lens WHERE name LIKE "%Digital%";


Input:
[INST] Here is a database schema:
mountain :
id [ INT ] primary_key
name [ TEXT ]
Height [ INT ]
Prominence [ INT ]
Range [ TEXT ]
Country [ TEXT ]

camera_lens :
id [ INT ] primary_key
brand [ TEXT ]
name [ TEXT ]
focal_length_mm [ INT ]
max_aperture [ INT ]

photos :
id [ INT ] primary_key
camera_lens_id [ INT ] photos.camera_lens_id = camera_lens.id
mountain_id [ INT ] photos.mountain_id = mountain.id
color [ TEXT ]
name [ TEXT ]

Please write me a SQL statement that answers the following question: What is the name of each camera lens and the number of photos taken by it? Order the result by the count of photos. [/INST]

Output: SELECT T1.name ,  count(*) FROM camera_lens AS T1 JOIN photos AS T2 ON T1.id  =  T2.camera_lens_id GROUP BY T1.id ORDER BY count(*);


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Find the names of channels that are not owned by CCTV. [/INST]

Output: SELECT name FROM channel WHERE OWNER != 'CCTV';


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Which channels are not owned by CCTV? Give me the channel names. [/INST]

Output: SELECT name FROM channel WHERE OWNER != 'CCTV';


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: List all channel names ordered by their rating in percent from big to small. [/INST]

Output: SELECT name FROM channel ORDER BY rating_in_percent DESC;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Give me a list of all the channel names sorted by the channel rating in descending order. [/INST]

Output: SELECT name FROM channel ORDER BY rating_in_percent DESC;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: What is the owner of the channel that has the highest rating ratio? [/INST]

Output: SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Show me the owner of the channel with the highest rating. [/INST]

Output: SELECT OWNER FROM channel ORDER BY rating_in_percent DESC LIMIT 1;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: how many programs are there? [/INST]

Output: SELECT count(*) FROM program;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Count the number of programs. [/INST]

Output: SELECT count(*) FROM program;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: list all the names of programs, ordering by launch time. [/INST]

Output: SELECT name FROM program ORDER BY launch;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: What is the list of program names, sorted by the order of launch date? [/INST]

Output: SELECT name FROM program ORDER BY launch;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: List the name, origin and owner of each program. [/INST]

Output: SELECT name ,  origin ,  OWNER FROM program;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: What are the name, origin and owner of each program? [/INST]

Output: SELECT name ,  origin ,  OWNER FROM program;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: find the name of the program that was launched most recently. [/INST]

Output: SELECT name FROM program ORDER BY launch DESC LIMIT 1;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Which program was launched most recently? Return the program name. [/INST]

Output: SELECT name FROM program ORDER BY launch DESC LIMIT 1;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: find the total percentage share of all channels owned by CCTV. [/INST]

Output: SELECT sum(Share_in_percent) FROM channel WHERE OWNER  =  'CCTV';


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: What is the total share (in percent) of all the channels owned by CCTV? [/INST]

Output: SELECT sum(Share_in_percent) FROM channel WHERE OWNER  =  'CCTV';


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Find the names of the channels that are broadcast in the morning. [/INST]

Output: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id  =  t2.channel_id WHERE t2.time_of_day  =  'Morning';


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Which channels are broadcast in the morning? Give me the channel names. [/INST]

Output: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id  =  t2.channel_id WHERE t2.time_of_day  =  'Morning';


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: what are the names of the channels that broadcast in both morning and night? [/INST]

Output: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id  =  t2.channel_id WHERE t2.time_of_day  =  'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id  =  t2.channel_id WHERE t2.time_of_day  =  'Night';


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Which channels broadcast both in the morning and at night? Give me the channel names. [/INST]

Output: SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id  =  t2.channel_id WHERE t2.time_of_day  =  'Morning' INTERSECT SELECT t1.name FROM channel AS t1 JOIN broadcast AS t2 ON t1.channel_id  =  t2.channel_id WHERE t2.time_of_day  =  'Night';


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: how many programs are broadcast in each time section of the day? [/INST]

Output: SELECT count(*) ,  time_of_day FROM broadcast GROUP BY time_of_day;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Count the number of programs broadcast for each time section of a day. [/INST]

Output: SELECT count(*) ,  time_of_day FROM broadcast GROUP BY time_of_day;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: find the number of different programs that are broadcast during night time. [/INST]

Output: SELECT count(DISTINCT program_id) FROM broadcast WHERE time_of_day  =  'Night';


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: How many distinct programs are broadcast at "Night" time? [/INST]

Output: SELECT count(DISTINCT program_id) FROM broadcast WHERE time_of_day  =  'Night';


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Find the names of programs that are never broadcasted in the morning. [/INST]

Output: SELECT name FROM program EXCEPT SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id  =  t2.program_id WHERE t2.Time_of_day  =  "Morning";


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Which programs are never broadcasted in the morning? Give me the names of the programs. [/INST]

Output: SELECT name FROM program EXCEPT SELECT t1.name FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id  =  t2.program_id WHERE t2.Time_of_day  =  "Morning";


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: find the program owners that have some programs in both morning and night time. [/INST]

Output: SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id  =  t2.program_id WHERE t2.Time_of_day  =  "Morning" INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id  =  t2.program_id WHERE t2.Time_of_day  =  "Night";


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Who are the owners of the programs that broadcast both in the morning and at night? [/INST]

Output: SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id  =  t2.program_id WHERE t2.Time_of_day  =  "Morning" INTERSECT SELECT t1.owner FROM program AS t1 JOIN broadcast AS t2 ON t1.program_id  =  t2.program_id WHERE t2.Time_of_day  =  "Night";


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: List all program origins in the alphabetical order. [/INST]

Output: SELECT origin FROM program ORDER BY origin;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: What is the list of program origins ordered alphabetically? [/INST]

Output: SELECT origin FROM program ORDER BY origin;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: what is the number of different channel owners? [/INST]

Output: SELECT count(DISTINCT OWNER) FROM channel;


Input:
[INST] Here is a database schema:
program :
Program_ID [ INT ] primary_key
Name [ TEXT ]
Origin [ TEXT ]
Launch [ INT ]
Owner [ TEXT ]

channel :
Channel_ID [ INT ] primary_key
Name [ TEXT ]
Owner [ TEXT ]
Share_in_percent [ INT ]
Rating_in_percent [ INT ]

broadcast :
Channel_ID [ INT ] primary_key broadcast.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast.Program_ID = program.Program_ID
Time_of_day [ TEXT ]

broadcast_share :
Channel_ID [ INT ] primary_key broadcast_share.Channel_ID = channel.Channel_ID
Program_ID [ INT ] broadcast_share.Program_ID = program.Program_ID
Date [ TEXT ]
Share_in_percent [ INT ]

Please write me a SQL statement that answers the following question: Count the number of distinct channel owners. [/INST]

Output: SELECT count(DISTINCT OWNER) FROM channel;