Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: List all country and league names. [/INST]

Output: SELECT T1.name ,  T2.name FROM Country AS T1 JOIN League AS T2 ON T1.id  =  T2.country_id;


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: How many leagues are there in England? [/INST]

Output: SELECT count(*) FROM Country AS T1 JOIN League AS T2 ON T1.id  =  T2.country_id WHERE T1.name  =  "England";


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average weight of all players? [/INST]

Output: SELECT avg(weight) FROM Player;


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: What is the maximum and minimum height of all players? [/INST]

Output: SELECT max(weight) ,  min(weight) FROM Player;


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: List all player names who have an overall rating higher than the average. [/INST]

Output: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.overall_rating  >  ( SELECT avg(overall_rating) FROM Player_Attributes );


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of players who have the best dribbling? [/INST]

Output: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.dribbling  =  ( SELECT max(overall_rating) FROM Player_Attributes);


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of all players who have a crossing score higher than 90 and prefer their right foot. [/INST]

Output: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.crossing  >  90 AND T2.preferred_foot  =  "right";


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of all left-footed players who have overall rating between 85 and 90. [/INST]

Output: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id = T2.player_api_id WHERE T2.preferred_foot  =  "left" AND T2.overall_rating  >=  85 AND T2.overall_rating  <=  90;


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: What is the average rating for right-footed players and left-footed players? [/INST]

Output: SELECT preferred_foot ,  avg(overall_rating) FROM Player_Attributes GROUP BY preferred_foot;


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: Of all players with an overall rating greater than 80, how many are right-footed and left-footed? [/INST]

Output: SELECT preferred_foot ,  count(*) FROM Player_Attributes WHERE overall_rating  >  80 GROUP BY preferred_foot;


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: List all of the player ids with a height of at least 180cm and an overall rating higher than 85. [/INST]

Output: SELECT player_api_id FROM Player WHERE height  >=  180 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE overall_rating  >  85;


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: List all of the ids for left-footed players with a height between 180cm and 190cm. [/INST]

Output: SELECT player_api_id FROM Player WHERE height  >=  180 AND height  <=  190 INTERSECT SELECT player_api_id FROM Player_Attributes WHERE preferred_foot  =  "left";


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: Who are the top 3 players in terms of overall rating? [/INST]

Output: SELECT DISTINCT T1.player_name FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id  =  T2.player_api_id ORDER BY overall_rating DESC LIMIT 3;


Input:
[INST] Here is a database schema:
Player_Attributes :
id [ INT ] primary_key
player_fifa_api_id [ INT ] Player_Attributes.player_fifa_api_id = Player.player_fifa_api_id
player_api_id [ INT ] Player_Attributes.player_api_id = Player.player_api_id
date [ TEXT ]
overall_rating [ INT ]
potential [ INT ]
preferred_foot [ TEXT ]
attacking_work_rate [ TEXT ]
defensive_work_rate [ TEXT ]
crossing [ INT ]
finishing [ INT ]
heading_accuracy [ INT ]
short_passing [ INT ]
volleys [ INT ]
dribbling [ INT ]
curve [ INT ]
free_kick_accuracy [ INT ]
long_passing [ INT ]
ball_control [ INT ]
acceleration [ INT ]
sprint_speed [ INT ]
agility [ INT ]
reactions [ INT ]
balance [ INT ]
shot_power [ INT ]
jumping [ INT ]
stamina [ INT ]
strength [ INT ]
long_shots [ INT ]
aggression [ INT ]
interceptions [ INT ]
positioning [ INT ]
vision [ INT ]
penalties [ INT ]
marking [ INT ]
standing_tackle [ INT ]
sliding_tackle [ INT ]
gk_diving [ INT ]
gk_handling [ INT ]
gk_kicking [ INT ]
gk_positioning [ INT ]
gk_reflexes [ INT ]

sqlite_sequence :
name [ TEXT ]
seq [ TEXT ]

Player :
id [ INT ] primary_key
player_api_id [ INT ]
player_name [ TEXT ]
player_fifa_api_id [ INT ]
birthday [ TEXT ]
height [ INT ]
weight [ INT ]

League :
id [ INT ] primary_key
country_id [ INT ] League.country_id = Country.id
name [ TEXT ]

Country :
id [ INT ] primary_key
name [ TEXT ]

Team :
id [ INT ] primary_key
team_api_id [ INT ]
team_fifa_api_id [ INT ]
team_long_name [ TEXT ]
team_short_name [ TEXT ]

Team_Attributes :
id [ INT ] primary_key
team_fifa_api_id [ INT ] Team_Attributes.team_fifa_api_id = Team.team_fifa_api_id
team_api_id [ INT ] Team_Attributes.team_api_id = Team.team_api_id
date [ TEXT ]
buildUpPlaySpeed [ INT ]
buildUpPlaySpeedClass [ TEXT ]
buildUpPlayDribbling [ INT ]
buildUpPlayDribblingClass [ TEXT ]
buildUpPlayPassing [ INT ]
buildUpPlayPassingClass [ TEXT ]
buildUpPlayPositioningClass [ TEXT ]
chanceCreationPassing [ INT ]
chanceCreationPassingClass [ TEXT ]
chanceCreationCrossing [ INT ]
chanceCreationCrossingClass [ TEXT ]
chanceCreationShooting [ INT ]
chanceCreationShootingClass [ TEXT ]
chanceCreationPositioningClass [ TEXT ]
defencePressure [ INT ]
defencePressureClass [ TEXT ]
defenceAggression [ INT ]
defenceAggressionClass [ TEXT ]
defenceTeamWidth [ INT ]
defenceTeamWidthClass [ TEXT ]
defenceDefenderLineClass [ TEXT ]

Please write me a SQL statement that answers the following question: List the names and birthdays of the top five players in terms of potential. [/INST]

Output: SELECT DISTINCT T1.player_name ,  T1.birthday FROM Player AS T1 JOIN Player_Attributes AS T2 ON T1.player_api_id  =  T2.player_api_id ORDER BY potential DESC LIMIT 5;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

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

Output: SELECT count(*) FROM performance;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: List the hosts of performances in ascending order of attendance. [/INST]

Output: SELECT HOST FROM performance ORDER BY Attendance ASC;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: What are the dates and locations of performances? [/INST]

Output: SELECT Date ,  LOCATION FROM performance;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: Show the attendances of the performances at location "TD Garden" or "Bell Centre" [/INST]

Output: SELECT Attendance FROM performance WHERE LOCATION  =  "TD Garden" OR LOCATION  =  "Bell Centre";


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: What is the average number of attendees for performances? [/INST]

Output: SELECT avg(Attendance) FROM performance;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: What is the date of the performance with the highest number of attendees? [/INST]

Output: SELECT Date FROM performance ORDER BY Attendance DESC LIMIT 1;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: Show different locations and the number of performances at each location. [/INST]

Output: SELECT LOCATION ,  COUNT(*) FROM performance GROUP BY LOCATION;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: Show the most common location of performances. [/INST]

Output: SELECT LOCATION FROM performance GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: Show the locations that have at least two performances. [/INST]

Output: SELECT LOCATION FROM performance GROUP BY LOCATION HAVING COUNT(*)  >=  2;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: Show the locations that have both performances with more than 2000 attendees and performances with less than 1000 attendees. [/INST]

Output: SELECT LOCATION FROM performance WHERE Attendance  >  2000 INTERSECT SELECT LOCATION FROM performance WHERE Attendance  <  1000;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: Show the names of members and the location of the performances they attended. [/INST]

Output: SELECT T2.Name ,  T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID  =  T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID  =  T3.Performance_ID;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: Show the names of members and the location of performances they attended in ascending alphabetical order of their names. [/INST]

Output: SELECT T2.Name ,  T3.Location FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID  =  T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID  =  T3.Performance_ID ORDER BY T2.Name ASC;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: Show the dates of performances with attending members whose roles are "Violin". [/INST]

Output: SELECT T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID  =  T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID  =  T3.Performance_ID WHERE T2.Role  =  "Violin";


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: Show the names of members and the dates of performances they attended in descending order of attendance of the performances. [/INST]

Output: SELECT T2.Name ,  T3.Date FROM member_attendance AS T1 JOIN member AS T2 ON T1.Member_ID  =  T2.Member_ID JOIN performance AS T3 ON T1.Performance_ID  =  T3.Performance_ID ORDER BY T3.Attendance DESC;


Input:
[INST] Here is a database schema:
member :
Member_ID [ TEXT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Role [ TEXT ]

performance :
Performance_ID [ INT ] primary_key
Date [ TEXT ]
Host [ TEXT ]
Location [ TEXT ]
Attendance [ INT ]

member_attendance :
Member_ID [ INT ] primary_key member_attendance.Member_ID = member.Member_ID
Performance_ID [ INT ] member_attendance.Performance_ID = performance.Performance_ID
Num_of_Pieces [ INT ]

Please write me a SQL statement that answers the following question: List the names of members who did not attend any performance. [/INST]

Output: SELECT Name FROM member WHERE Member_ID NOT IN (SELECT Member_ID FROM member_attendance);


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the buildings which have rooms with capacity more than 50. [/INST]

Output: SELECT DISTINCT building FROM classroom WHERE capacity  >  50;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the distinct buildings with capacities of greater than 50? [/INST]

Output: SELECT DISTINCT building FROM classroom WHERE capacity  >  50;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Count the number of rooms that are not in the Lamberton building. [/INST]

Output: SELECT count(*) FROM classroom WHERE building != 'Lamberton';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: How many classrooms are not in Lamberton? [/INST]

Output: SELECT count(*) FROM classroom WHERE building != 'Lamberton';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What is the name and building of the departments whose budget is more than the average budget? [/INST]

Output: SELECT dept_name ,  building FROM department WHERE budget  >  (SELECT avg(budget) FROM department);


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Give the name and building of the departments with greater than average budget. [/INST]

Output: SELECT dept_name ,  building FROM department WHERE budget  >  (SELECT avg(budget) FROM department);


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the room number of the rooms which can sit 50 to 100 students and their buildings. [/INST]

Output: SELECT building ,  room_number FROM classroom WHERE capacity BETWEEN 50 AND 100;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the room numbers and corresponding buildings for classrooms which can seat between 50 to 100 students? [/INST]

Output: SELECT building ,  room_number FROM classroom WHERE capacity BETWEEN 50 AND 100;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the name and building of the department with the highest budget. [/INST]

Output: SELECT dept_name ,  building FROM department ORDER BY budget DESC LIMIT 1;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What is the department name and corresponding building for the department with the greatest budget? [/INST]

Output: SELECT dept_name ,  building FROM department ORDER BY budget DESC LIMIT 1;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What is the name of the student who has the highest total credits in the History department. [/INST]

Output: SELECT name FROM student WHERE dept_name  =  'History' ORDER BY tot_cred DESC LIMIT 1;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Give the name of the student in the History department with the most credits. [/INST]

Output: SELECT name FROM student WHERE dept_name  =  'History' ORDER BY tot_cred DESC LIMIT 1;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: How many rooms does the Lamberton building have? [/INST]

Output: SELECT count(*) FROM classroom WHERE building  =  'Lamberton';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

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

Output: SELECT count(*) FROM classroom WHERE building  =  'Lamberton';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: How many students have advisors? [/INST]

Output: SELECT count(DISTINCT s_id) FROM advisor;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

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

Output: SELECT count(DISTINCT s_id) FROM advisor;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: How many departments offer courses? [/INST]

Output: SELECT count(DISTINCT dept_name) FROM course;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

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

Output: SELECT count(DISTINCT dept_name) FROM course;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: How many different courses offered by Physics department? [/INST]

Output: SELECT count(DISTINCT course_id) FROM course WHERE dept_name  =  'Physics';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

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

Output: SELECT count(DISTINCT course_id) FROM course WHERE dept_name  =  'Physics';


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the title of courses that have two prerequisites? [/INST]

Output: SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id  =  T2.course_id GROUP BY T2.course_id HAVING count(*)  =  2;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What are the titles for courses with two prerequisites? [/INST]

Output: SELECT T1.title FROM course AS T1 JOIN prereq AS T2 ON T1.course_id  =  T2.course_id GROUP BY T2.course_id HAVING count(*)  =  2;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: Find the title, credit, and department name of courses that have more than one prerequisites? [/INST]

Output: SELECT T1.title ,  T1.credits , T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id  =  T2.course_id GROUP BY T2.course_id HAVING count(*)  >  1;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: What is the title, credit value, and department name for courses with more than one prerequisite? [/INST]

Output: SELECT T1.title ,  T1.credits , T1.dept_name FROM course AS T1 JOIN prereq AS T2 ON T1.course_id  =  T2.course_id GROUP BY T2.course_id HAVING count(*)  >  1;


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

Please write me a SQL statement that answers the following question: How many courses that do not have prerequisite? [/INST]

Output: SELECT count(*) FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq);


Input:
[INST] Here is a database schema:
classroom :
building [ TEXT ] primary_key
room_number [ TEXT ]
capacity [ INT ]

department :
dept_name [ TEXT ] primary_key
building [ TEXT ]
budget [ INT ]

course :
course_id [ TEXT ] primary_key
title [ TEXT ]
dept_name [ TEXT ] course.dept_name = department.dept_name
credits [ INT ]

instructor :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] instructor.dept_name = department.dept_name
salary [ INT ]

section :
course_id [ TEXT ] primary_key section.course_id = course.course_id
sec_id [ TEXT ]
semester [ TEXT ]
year [ INT ]
building [ TEXT ] section.building = classroom.building
room_number [ TEXT ] section.room_number = classroom.room_number
time_slot_id [ TEXT ]

teaches :
ID [ TEXT ] primary_key teaches.ID = instructor.ID
course_id [ TEXT ] teaches.course_id = section.course_id
sec_id [ TEXT ] teaches.sec_id = section.sec_id
semester [ TEXT ] teaches.semester = section.semester
year [ INT ] teaches.year = section.year

student :
ID [ TEXT ] primary_key
name [ TEXT ]
dept_name [ TEXT ] student.dept_name = department.dept_name
tot_cred [ INT ]

takes :
ID [ TEXT ] primary_key takes.ID = student.ID
course_id [ TEXT ] takes.course_id = section.course_id
sec_id [ TEXT ] takes.sec_id = section.sec_id
semester [ TEXT ] takes.semester = section.semester
year [ INT ] takes.year = section.year
grade [ TEXT ]

advisor :
s_ID [ TEXT ] primary_key advisor.s_ID = student.ID
i_ID [ TEXT ] advisor.i_ID = instructor.ID

time_slot :
time_slot_id [ TEXT ] primary_key
day [ TEXT ]
start_hr [ INT ]
start_min [ INT ]
end_hr [ INT ]
end_min [ INT ]

prereq :
course_id [ TEXT ] primary_key prereq.course_id = course.course_id
prereq_id [ TEXT ] prereq.prereq_id = course.course_id

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

Output: SELECT count(*) FROM course WHERE course_id NOT IN (SELECT course_id FROM prereq);