Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: How many hosts does each nationality have? List the nationality and the count. [/INST]

Output: SELECT Nationality ,  COUNT(*) FROM HOST GROUP BY Nationality;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

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

Output: SELECT Nationality FROM HOST GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: Which nationality has the most hosts? [/INST]

Output: SELECT Nationality FROM HOST GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: Show the nations that have both hosts older than 45 and hosts younger than 35. [/INST]

Output: SELECT Nationality FROM HOST WHERE Age  >  45 INTERSECT SELECT Nationality FROM HOST WHERE Age  <  35;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: Which nations have both hosts of age above 45 and hosts of age below 35? [/INST]

Output: SELECT Nationality FROM HOST WHERE Age  >  45 INTERSECT SELECT Nationality FROM HOST WHERE Age  <  35;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: Show the themes of parties and the names of the party hosts. [/INST]

Output: SELECT T3.Party_Theme ,  T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: For each party, return its theme and the name of its host. [/INST]

Output: SELECT T3.Party_Theme ,  T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: Show the locations of parties and the names of the party hosts in ascending order of the age of the host. [/INST]

Output: SELECT T3.Location ,  T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID ORDER BY T2.Age;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: For each party, find its location and the name of its host. Sort the result in ascending order of the age of the host. [/INST]

Output: SELECT T3.Location ,  T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID ORDER BY T2.Age;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: Show the locations of parties with hosts older than 50. [/INST]

Output: SELECT T3.Location FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID WHERE T2.Age  >  50;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: Which parties have hosts of age above 50? Give me the party locations. [/INST]

Output: SELECT T3.Location FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID WHERE T2.Age  >  50;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: Show the host names for parties with number of hosts greater than 20. [/INST]

Output: SELECT T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID WHERE T3.Number_of_hosts  >  20;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: Which parties have more than 20 hosts? Give me the host names for these parties. [/INST]

Output: SELECT T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID WHERE T3.Number_of_hosts  >  20;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: Show the name and the nationality of the oldest host. [/INST]

Output: SELECT Name ,  Nationality FROM HOST ORDER BY Age DESC LIMIT 1;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: What are the name and the nationality of the host of the highest age? [/INST]

Output: SELECT Name ,  Nationality FROM HOST ORDER BY Age DESC LIMIT 1;


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: List the names of hosts who did not serve as a host of any party in our record. [/INST]

Output: SELECT Name FROM HOST WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host);


Input:
[INST] Here is a database schema:
party :
Party_ID [ INT ] primary_key
Party_Theme [ TEXT ]
Location [ TEXT ]
First_year [ TEXT ]
Last_year [ TEXT ]
Number_of_hosts [ INT ]

host :
Host_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]

party_host :
Party_ID [ INT ] primary_key party_host.Party_ID = party.Party_ID
Host_ID [ INT ] party_host.Host_ID = host.Host_ID
Is_Main_in_Charge [ bool ]

Please write me a SQL statement that answers the following question: What are the names of hosts who did not host any party in our record? [/INST]

Output: SELECT Name FROM HOST WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host);


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

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

Output: SELECT count(*) FROM region;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

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

Output: SELECT count(*) FROM region;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Show all region code and region name sorted by the codes. [/INST]

Output: SELECT region_code ,  region_name FROM region ORDER BY region_code;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the codes and names for all regions, sorted by codes? [/INST]

Output: SELECT region_code ,  region_name FROM region ORDER BY region_code;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

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

Output: SELECT region_name FROM region ORDER BY region_name;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the names of the regions in alphabetical order? [/INST]

Output: SELECT region_name FROM region ORDER BY region_name;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Show names for all regions except for Denmark. [/INST]

Output: SELECT region_name FROM region WHERE region_name != 'Denmark';


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Return the names of all regions other than Denmark. [/INST]

Output: SELECT region_name FROM region WHERE region_name != 'Denmark';


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: How many storms had death records? [/INST]

Output: SELECT count(*) FROM storm WHERE Number_Deaths  >  0;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Count the number of storms in which at least 1 person died. [/INST]

Output: SELECT count(*) FROM storm WHERE Number_Deaths  >  0;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: List name, dates active, and number of deaths for all storms with at least 1 death. [/INST]

Output: SELECT name ,  dates_active ,  number_deaths FROM storm WHERE number_deaths  >=  1;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the names, dates active, and number of deaths for storms that had 1 or more death? [/INST]

Output: SELECT name ,  dates_active ,  number_deaths FROM storm WHERE number_deaths  >=  1;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Show the average and maximum damage for all storms with max speed higher than 1000. [/INST]

Output: SELECT avg(damage_millions_USD) ,  max(damage_millions_USD) FROM storm WHERE max_speed  >  1000;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What is the average and maximum damage in millions for storms that had a max speed over 1000? [/INST]

Output: SELECT avg(damage_millions_USD) ,  max(damage_millions_USD) FROM storm WHERE max_speed  >  1000;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What is the total number of deaths and damage for all storms with a max speed greater than the average? [/INST]

Output: SELECT sum(number_deaths) ,  sum(damage_millions_USD) FROM storm WHERE max_speed  >  (SELECT avg(max_speed) FROM storm);


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Return the total number of deaths and total damange in millions for storms that had a max speed greater than the average. [/INST]

Output: SELECT sum(number_deaths) ,  sum(damage_millions_USD) FROM storm WHERE max_speed  >  (SELECT avg(max_speed) FROM storm);


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: List name and damage for all storms in a descending order of max speed. [/INST]

Output: SELECT name ,  damage_millions_USD FROM storm ORDER BY max_speed DESC;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the names and damage in millions for storms, ordered by their max speeds descending? [/INST]

Output: SELECT name ,  damage_millions_USD FROM storm ORDER BY max_speed DESC;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

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

Output: SELECT count(DISTINCT region_id) FROM affected_region;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

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

Output: SELECT count(DISTINCT region_id) FROM affected_region;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Show the name for regions not affected. [/INST]

Output: SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_region);


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the names of regions that were not affected? [/INST]

Output: SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_region);


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Show the name for regions and the number of storms for each region. [/INST]

Output: SELECT T1.region_name ,  count(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: How many storms occured in each region? [/INST]

Output: SELECT T1.region_name ,  count(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: List the name for storms and the number of affected regions for each storm. [/INST]

Output: SELECT T1.name ,  count(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: How many regions were affected by each storm? [/INST]

Output: SELECT T1.name ,  count(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What is the storm name and max speed which affected the greatest number of regions? [/INST]

Output: SELECT T1.name ,  T1.max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Return the name and max speed of the storm that affected the most regions. [/INST]

Output: SELECT T1.name ,  T1.max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Show the name of storms which don't have affected region in record. [/INST]

Output: SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_region);


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the names of storms that did not affect any regions? [/INST]

Output: SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_region);


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Show storm name with at least two regions and 10 cities affected. [/INST]

Output: SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING count(*)  >=  2 INTERSECT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING sum(T2.number_city_affected)  >=  10;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the names of storms that both affected two or more regions and affected a total of 10 or more cities? [/INST]

Output: SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING count(*)  >=  2 INTERSECT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING sum(T2.number_city_affected)  >=  10;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Show all storm names except for those with at least two affected regions. [/INST]

Output: SELECT name FROM storm EXCEPT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the names of storms that did not affect two or more regions? [/INST]

Output: SELECT name FROM storm EXCEPT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id  =  T2.storm_id GROUP BY T1.storm_id HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the region names affected by the storm with a number of deaths of least 10? [/INST]

Output: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T3.number_deaths  >=  10;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Return the names of the regions affected by storms that had a death count of at least 10. [/INST]

Output: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T3.number_deaths  >=  10;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Show all storm names affecting region "Denmark". [/INST]

Output: SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T2.region_name  =  'Denmark';


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the names of the storms that affected Denmark? [/INST]

Output: SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T2.region_name  =  'Denmark';


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Show the region name with at least two storms. [/INST]

Output: SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the names of regions with two or more storms? [/INST]

Output: SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING count(*)  >=  2;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Find the names of the regions which were affected by the storm that killed the greatest number of people. [/INST]

Output: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id ORDER BY T3.Number_Deaths DESC LIMIT 1;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the names of regions that were affected by the storm in which the most people died? [/INST]

Output: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id ORDER BY T3.Number_Deaths DESC LIMIT 1;


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: Find the name of the storm that affected both Afghanistan and Albania regions. [/INST]

Output: SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T2.Region_name  =  'Afghanistan' INTERSECT SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T2.Region_name  =  'Albania';


Input:
[INST] Here is a database schema:
storm :
Storm_ID [ INT ] primary_key
Name [ TEXT ]
Dates_active [ TEXT ]
Max_speed [ INT ]
Damage_millions_USD [ INT ]
Number_Deaths [ INT ]

region :
Region_id [ INT ] primary_key
Region_code [ TEXT ]
Region_name [ TEXT ]

affected_region :
Region_id [ INT ] primary_key affected_region.Region_id = region.Region_id
Storm_ID [ INT ] affected_region.Storm_ID = storm.Storm_ID
Number_city_affected [ INT ]

Please write me a SQL statement that answers the following question: What are the names of the storms that affected both the regions of Afghanistan and Albania? [/INST]

Output: SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T2.Region_name  =  'Afghanistan' INTERSECT SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id  =  T2.region_id JOIN storm AS T3 ON T1.storm_id  =  T3.storm_id WHERE T2.Region_name  =  'Albania';


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

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

Output: SELECT count(*) FROM county;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

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

Output: SELECT count(*) FROM county;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the county name and population of all counties. [/INST]

Output: SELECT County_name ,  Population FROM county;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: What are the name and population of each county? [/INST]

Output: SELECT County_name ,  Population FROM county;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the average population of all counties. [/INST]

Output: SELECT avg(Population) FROM county;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: On average how large is the population of the counties? [/INST]

Output: SELECT avg(Population) FROM county;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Return the maximum and minimum population among all counties. [/INST]

Output: SELECT max(Population) ,  min(Population) FROM county;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: What are the maximum and minimum population of the counties? [/INST]

Output: SELECT max(Population) ,  min(Population) FROM county;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show all the distinct districts for elections. [/INST]

Output: SELECT DISTINCT District FROM election;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: What are the distinct districts for elections? [/INST]

Output: SELECT DISTINCT District FROM election;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the zip code of the county with name "Howard". [/INST]

Output: SELECT Zip_code FROM county WHERE County_name  =  "Howard";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: What is the zip code the county named "Howard" is located in? [/INST]

Output: SELECT Zip_code FROM county WHERE County_name  =  "Howard";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the delegate from district 1 in election. [/INST]

Output: SELECT Delegate FROM election WHERE District  =  1;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Who is the delegate of district 1 in the elections? [/INST]

Output: SELECT Delegate FROM election WHERE District  =  1;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the delegate and committee information of elections. [/INST]

Output: SELECT Delegate ,  Committee FROM election;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: What are the delegate and committee information for each election record? [/INST]

Output: SELECT Delegate ,  Committee FROM election;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

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

Output: SELECT count(DISTINCT Governor) FROM party;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

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

Output: SELECT count(DISTINCT Governor) FROM party;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the lieutenant governor and comptroller from the democratic party. [/INST]

Output: SELECT Lieutenant_Governor ,  Comptroller FROM party WHERE Party  =  "Democratic";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Who are the lieutenant governor and comptroller from the democratic party? [/INST]

Output: SELECT Lieutenant_Governor ,  Comptroller FROM party WHERE Party  =  "Democratic";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: In which distinct years was the governor "Eliot Spitzer"? [/INST]

Output: SELECT DISTINCT YEAR FROM party WHERE Governor  =  "Eliot Spitzer";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Find the distinct years when the governor was named "Eliot Spitzer". [/INST]

Output: SELECT DISTINCT YEAR FROM party WHERE Governor  =  "Eliot Spitzer";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show all the information about election. [/INST]

Output: SELECT * FROM election;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Return all the information for each election record. [/INST]

Output: SELECT * FROM election;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the delegates and the names of county they belong to. [/INST]

Output: SELECT T2.Delegate ,  T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: What are the delegate and name of the county they belong to, for each county? [/INST]

Output: SELECT T2.Delegate ,  T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Which delegates are from counties with population smaller than 100000? [/INST]

Output: SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T1.Population  <  100000;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Find the delegates who are from counties with population below 100000. [/INST]

Output: SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T1.Population  <  100000;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: How many distinct delegates are from counties with population larger than 50000? [/INST]

Output: SELECT count(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T1.Population  >  50000;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of distinct delegates who are from counties with population above 50000. [/INST]

Output: SELECT count(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T1.Population  >  50000;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of the county that the delegates on "Appropriations" committee belong to? [/INST]

Output: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T2.Committee  =  "Appropriations";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Which county do the delegates on "Appropriations" committee belong to? Give me the county names. [/INST]

Output: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District WHERE T2.Committee  =  "Appropriations";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the delegates and the names of the party they belong to. [/INST]

Output: SELECT T1.Delegate ,  T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: For each delegate, find the names of the party they are part of. [/INST]

Output: SELECT T1.Delegate ,  T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Who were the governors of the parties associated with delegates from district 1? [/INST]

Output: SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.District  =  1;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Find the parties associated with the delegates from district 1. Who served as governors of the parties? [/INST]

Output: SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.District  =  1;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Who were the comptrollers of the parties associated with the delegates from district 1 or district 2? [/INST]

Output: SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.District  =  1 OR T1.District  =  2;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Find the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties? [/INST]

Output: SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.District  =  1 OR T1.District  =  2;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Return all the committees that have delegates from Democratic party. [/INST]

Output: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Democratic";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Which committees have delegates from the Democratic party? [/INST]

Output: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Democratic";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the name of each county along with the corresponding number of delegates from that county. [/INST]

Output: SELECT T1.County_name ,  COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District GROUP BY T1.County_id;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: For each county, find the name of the county and the number of delegates from that county. [/INST]

Output: SELECT T1.County_name ,  COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District GROUP BY T1.County_id;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the name of each party and the corresponding number of delegates from that party. [/INST]

Output: SELECT T2.Party ,  COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID GROUP BY T1.Party;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: For each party, return the name of the party and the number of delegates from that party. [/INST]

Output: SELECT T2.Party ,  COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID GROUP BY T1.Party;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Return the names of all counties sorted by population in ascending order. [/INST]

Output: SELECT County_name FROM county ORDER BY Population ASC;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Sort the names of all counties in ascending order of population. [/INST]

Output: SELECT County_name FROM county ORDER BY Population ASC;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Return the names of all counties sorted by county name in descending alphabetical order. [/INST]

Output: SELECT County_name FROM county ORDER BY County_name DESC;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Sort the names of all counties in descending alphabetical order. [/INST]

Output: SELECT County_name FROM county ORDER BY County_name DESC;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the name of the county with the biggest population. [/INST]

Output: SELECT County_name FROM county ORDER BY Population DESC LIMIT 1;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Which county has the largest population? Give me the name of the county. [/INST]

Output: SELECT County_name FROM county ORDER BY Population DESC LIMIT 1;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the 3 counties with the smallest population. [/INST]

Output: SELECT County_name FROM county ORDER BY Population ASC LIMIT 3;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: What are the 3 counties that have the smallest population? Give me the county names. [/INST]

Output: SELECT County_name FROM county ORDER BY Population ASC LIMIT 3;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the names of counties that have at least two delegates. [/INST]

Output: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District GROUP BY T1.County_id HAVING COUNT(*)  >=  2;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Which counties have two or more delegates? Give me the county names. [/INST]

Output: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id  =  T2.District GROUP BY T1.County_id HAVING COUNT(*)  >=  2;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the name of the party that has at least two records. [/INST]

Output: SELECT Party FROM party GROUP BY Party HAVING COUNT(*)  >=  2;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Which party has two or more records? [/INST]

Output: SELECT Party FROM party GROUP BY Party HAVING COUNT(*)  >=  2;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the name of the party that has the most delegates. [/INST]

Output: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID GROUP BY T1.Party ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Which party has the largest number of delegates? [/INST]

Output: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID GROUP BY T1.Party ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the people that have been governor the most times. [/INST]

Output: SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Which people severed as governor most frequently? [/INST]

Output: SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Show the people that have been comptroller the most times and the corresponding number of times. [/INST]

Output: SELECT Comptroller ,  COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Which people severed as comptroller most frequently? Give me the name of the person and the frequency count. [/INST]

Output: SELECT Comptroller ,  COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of parties that do not have delegates in election? [/INST]

Output: SELECT Party FROM party WHERE Party_ID NOT IN (SELECT Party FROM election);


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Which parties did not have any delegates in elections? [/INST]

Output: SELECT Party FROM party WHERE Party_ID NOT IN (SELECT Party FROM election);


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: What are the names of parties that have both delegates on "Appropriations" committee and [/INST]

Output: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.Committee  =  "Appropriations" INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.Committee  =  "Economic Matters";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Which parties have delegates in both the "Appropriations" committee and the "Economic Matters" committee? [/INST]

Output: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.Committee  =  "Appropriations" INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T1.Committee  =  "Economic Matters";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Which committees have delegates from both democratic party and liberal party? [/INST]

Output: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Democratic" INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Liberal";


Input:
[INST] Here is a database schema:
county :
County_Id [ INT ] primary_key
County_name [ TEXT ]
Population [ INT ]
Zip_code [ TEXT ]

party :
Party_ID [ INT ] primary_key
Year [ INT ]
Party [ TEXT ]
Governor [ TEXT ]
Lieutenant_Governor [ TEXT ]
Comptroller [ TEXT ]
Attorney_General [ TEXT ]
US_Senate [ TEXT ]

election :
Election_ID [ INT ] primary_key
Counties_Represented [ TEXT ]
District [ INT ] election.District = county.County_Id
Delegate [ TEXT ]
Party [ INT ] election.Party = party.Party_ID
First_Elected [ INT ]
Committee [ TEXT ]

Please write me a SQL statement that answers the following question: Find the committees that have delegates both from from the democratic party and the liberal party. [/INST]

Output: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Democratic" INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party  =  T2.Party_ID WHERE T2.Party  =  "Liberal";


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

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

Output: SELECT count(*) FROM journalist;


Input:
[INST] Here is a database schema:
event :
Event_ID [ INT ] primary_key
Date [ TEXT ]
Venue [ TEXT ]
Name [ TEXT ]
Event_Attendance [ INT ]

journalist :
journalist_ID [ INT ] primary_key
Name [ TEXT ]
Nationality [ TEXT ]
Age [ TEXT ]
Years_working [ INT ]

news_report :
journalist_ID [ INT ] primary_key news_report.journalist_ID = journalist.journalist_ID
Event_ID [ INT ] news_report.Event_ID = event.Event_ID
Work_Type [ TEXT ]

Please write me a SQL statement that answers the following question: List the names of journalists in ascending order of years working. [/INST]

Output: SELECT Name FROM journalist ORDER BY Years_working ASC;