brief_instruction stringlengths 16 224 | instruction stringlengths 687 8.77k | output stringlengths 18 577 |
|---|---|---|
List name, dates active, and number of deaths for all storms with at least 1 death. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List name, dates active, and number of deaths for all storms with at least 1 death.` to a syntactically-correct PostgreSQL query.
| SELECT name , dates_active , number_deaths FROM storm WHERE number_deaths >= 1 |
What are the names, dates active, and number of deaths for storms that had 1 or more death? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names, dates active, and number of deaths for storms that had 1 or more death?` to a syntactically-correct PostgreSQL query.
| SELECT name , dates_active , number_deaths FROM storm WHERE number_deaths >= 1 |
Show the average and maximum damage for all storms with max speed higher than 1000. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the average and maximum damage for all storms with max speed higher than 1000.` to a syntactically-correct PostgreSQL query.
| SELECT avg(damage_millions_USD) , max(damage_millions_USD) FROM storm WHERE max_speed > 1000 |
What is the average and maximum damage in millions for storms that had a max speed over 1000? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the average and maximum damage in millions for storms that had a max speed over 1000?` to a syntactically-correct PostgreSQL query.
| SELECT avg(damage_millions_USD) , max(damage_millions_USD) FROM storm WHERE max_speed > 1000 |
What is the total number of deaths and damage for all storms with a max speed greater than the average? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the total number of deaths and damage for all storms with a max speed greater than the average?` to a syntactically-correct PostgreSQL query.
| SELECT sum(number_deaths) , sum(damage_millions_USD) FROM storm WHERE max_speed > (SELECT avg(max_speed) FROM storm) |
Return the total number of deaths and total damange in millions for storms that had a max speed greater than the average. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Return the total number of deaths and total damange in millions for storms that had a max speed greater than the average.` to a syntactically-correct PostgreSQL query.
| SELECT sum(number_deaths) , sum(damage_millions_USD) FROM storm WHERE max_speed > (SELECT avg(max_speed) FROM storm) |
List name and damage for all storms in a descending order of max speed. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List name and damage for all storms in a descending order of max speed.` to a syntactically-correct PostgreSQL query.
| SELECT name , damage_millions_USD FROM storm ORDER BY max_speed DESC |
What are the names and damage in millions for storms, ordered by their max speeds descending? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names and damage in millions for storms, ordered by their max speeds descending?` to a syntactically-correct PostgreSQL query.
| SELECT name , damage_millions_USD FROM storm ORDER BY max_speed DESC |
How many regions are affected? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many regions are affected?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT region_id) FROM affected_region |
Count the number of different affected regions. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Count the number of different affected regions.` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT region_id) FROM affected_region |
Show the name for regions not affected. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the name for regions not affected.` to a syntactically-correct PostgreSQL query.
| SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_region) |
What are the names of regions that were not affected? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of regions that were not affected?` to a syntactically-correct PostgreSQL query.
| SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_region) |
Show the name for regions and the number of storms for each region. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the name for regions and the number of storms for each region.` to a syntactically-correct PostgreSQL query.
| 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 |
How many storms occured in each region? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many storms occured in each region?` to a syntactically-correct PostgreSQL query.
| 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 |
List the name for storms and the number of affected regions for each storm. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `List the name for storms and the number of affected regions for each storm.` to a syntactically-correct PostgreSQL query.
| 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 |
How many regions were affected by each storm? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many regions were affected by each storm?` to a syntactically-correct PostgreSQL query.
| 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 |
What is the storm name and max speed which affected the greatest number of regions? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the storm name and max speed which affected the greatest number of regions?` to a syntactically-correct PostgreSQL query.
| 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 |
Return the name and max speed of the storm that affected the most regions. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Return the name and max speed of the storm that affected the most regions.` to a syntactically-correct PostgreSQL query.
| 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 |
Show the name of storms which don't have affected region in record. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the name of storms which don't have affected region in record.` to a syntactically-correct PostgreSQL query.
| SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_region) |
What are the names of storms that did not affect any regions? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of storms that did not affect any regions?` to a syntactically-correct PostgreSQL query.
| SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_region) |
Show storm name with at least two regions and 10 cities affected. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show storm name with at least two regions and 10 cities affected.` to a syntactically-correct PostgreSQL query.
| 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 |
What are the names of storms that both affected two or more regions and affected a total of 10 or more cities? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of storms that both affected two or more regions and affected a total of 10 or more cities?` to a syntactically-correct PostgreSQL query.
| 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 |
Show all storm names except for those with at least two affected regions. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show all storm names except for those with at least two affected regions.` to a syntactically-correct PostgreSQL query.
| 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 |
What are the names of storms that did not affect two or more regions? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of storms that did not affect two or more regions?` to a syntactically-correct PostgreSQL query.
| 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 |
What are the region names affected by the storm with a number of deaths of least 10? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the region names affected by the storm with a number of deaths of least 10?` to a syntactically-correct PostgreSQL query.
| 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 |
Return the names of the regions affected by storms that had a death count of at least 10. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Return the names of the regions affected by storms that had a death count of at least 10.` to a syntactically-correct PostgreSQL query.
| 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 |
Show all storm names affecting region "Denmark". |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show all storm names affecting region "Denmark".` to a syntactically-correct PostgreSQL query.
| 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' |
What are the names of the storms that affected Denmark? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of the storms that affected Denmark?` to a syntactically-correct PostgreSQL query.
| 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' |
Show the region name with at least two storms. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the region name with at least two storms.` to a syntactically-correct PostgreSQL query.
| 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 |
What are the names of regions with two or more storms? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of regions with two or more storms?` to a syntactically-correct PostgreSQL query.
| 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 |
Find the names of the regions which were affected by the storm that killed the greatest number of people. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the names of the regions which were affected by the storm that killed the greatest number of people.` to a syntactically-correct PostgreSQL query.
| 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 |
What are the names of regions that were affected by the storm in which the most people died? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of regions that were affected by the storm in which the most people died?` to a syntactically-correct PostgreSQL query.
| 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 |
Find the name of the storm that affected both Afghanistan and Albania regions. |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the name of the storm that affected both Afghanistan and Albania regions.` to a syntactically-correct PostgreSQL query.
| 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' |
What are the names of the storms that affected both the regions of Afghanistan and Albania? |
-- Language PostgreSQL
-- Tables:
-- Table: storm
columns : [['storm id', 'number'], ['name', 'text'], ['dates active', 'text'], ['max speed', 'number'], ['damage millions usd', 'number'], ['number deaths', 'number']]
-- Table: region
columns : [['region id', 'number'], ['region code', 'text'], ['region name', 'text']]
-- Table: affected region
columns : [['region id', 'number'], ['storm id', 'number'], ['number city affected', 'number']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of the storms that affected both the regions of Afghanistan and Albania?` to a syntactically-correct PostgreSQL query.
| 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' |
How many counties are there in total? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many counties are there in total?` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM county |
Count the total number of counties. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Count the total number of counties.` to a syntactically-correct PostgreSQL query.
| SELECT count(*) FROM county |
Show the county name and population of all counties. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the county name and population of all counties.` to a syntactically-correct PostgreSQL query.
| SELECT County_name , Population FROM county |
What are the name and population of each county? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the name and population of each county?` to a syntactically-correct PostgreSQL query.
| SELECT County_name , Population FROM county |
Show the average population of all counties. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the average population of all counties.` to a syntactically-correct PostgreSQL query.
| SELECT avg(Population) FROM county |
On average how large is the population of the counties? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `On average how large is the population of the counties?` to a syntactically-correct PostgreSQL query.
| SELECT avg(Population) FROM county |
Return the maximum and minimum population among all counties. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Return the maximum and minimum population among all counties.` to a syntactically-correct PostgreSQL query.
| SELECT max(Population) , min(Population) FROM county |
What are the maximum and minimum population of the counties? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the maximum and minimum population of the counties?` to a syntactically-correct PostgreSQL query.
| SELECT max(Population) , min(Population) FROM county |
Show all the distinct districts for elections. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show all the distinct districts for elections.` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT District FROM election |
What are the distinct districts for elections? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the distinct districts for elections?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT District FROM election |
Show the zip code of the county with name "Howard". |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the zip code of the county with name "Howard".` to a syntactically-correct PostgreSQL query.
| SELECT Zip_code FROM county WHERE County_name = "Howard" |
What is the zip code the county named "Howard" is located in? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What is the zip code the county named "Howard" is located in?` to a syntactically-correct PostgreSQL query.
| SELECT Zip_code FROM county WHERE County_name = "Howard" |
Show the delegate from district 1 in election. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the delegate from district 1 in election.` to a syntactically-correct PostgreSQL query.
| SELECT Delegate FROM election WHERE District = 1 |
Who is the delegate of district 1 in the elections? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Who is the delegate of district 1 in the elections?` to a syntactically-correct PostgreSQL query.
| SELECT Delegate FROM election WHERE District = 1 |
Show the delegate and committee information of elections. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the delegate and committee information of elections.` to a syntactically-correct PostgreSQL query.
| SELECT Delegate , Committee FROM election |
What are the delegate and committee information for each election record? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the delegate and committee information for each election record?` to a syntactically-correct PostgreSQL query.
| SELECT Delegate , Committee FROM election |
How many distinct governors are there? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many distinct governors are there?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT Governor) FROM party |
Count the number of distinct governors. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Count the number of distinct governors.` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT Governor) FROM party |
Show the lieutenant governor and comptroller from the democratic party. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the lieutenant governor and comptroller from the democratic party.` to a syntactically-correct PostgreSQL query.
| SELECT Lieutenant_Governor , Comptroller FROM party WHERE Party = "Democratic" |
Who are the lieutenant governor and comptroller from the democratic party? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Who are the lieutenant governor and comptroller from the democratic party?` to a syntactically-correct PostgreSQL query.
| SELECT Lieutenant_Governor , Comptroller FROM party WHERE Party = "Democratic" |
In which distinct years was the governor "Eliot Spitzer"? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `In which distinct years was the governor "Eliot Spitzer"?` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT YEAR FROM party WHERE Governor = "Eliot Spitzer" |
Find the distinct years when the governor was named "Eliot Spitzer". |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the distinct years when the governor was named "Eliot Spitzer".` to a syntactically-correct PostgreSQL query.
| SELECT DISTINCT YEAR FROM party WHERE Governor = "Eliot Spitzer" |
Show all the information about election. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show all the information about election.` to a syntactically-correct PostgreSQL query.
| SELECT * FROM election |
Return all the information for each election record. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Return all the information for each election record.` to a syntactically-correct PostgreSQL query.
| SELECT * FROM election |
Show the delegates and the names of county they belong to. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the delegates and the names of county they belong to.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Delegate , T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District |
What are the delegate and name of the county they belong to, for each county? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the delegate and name of the county they belong to, for each county?` to a syntactically-correct PostgreSQL query.
| SELECT T2.Delegate , T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District |
Which delegates are from counties with population smaller than 100000? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which delegates are from counties with population smaller than 100000?` to a syntactically-correct PostgreSQL query.
| SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population < 100000 |
Find the delegates who are from counties with population below 100000. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the delegates who are from counties with population below 100000.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population < 100000 |
How many distinct delegates are from counties with population larger than 50000? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `How many distinct delegates are from counties with population larger than 50000?` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population > 50000 |
Count the number of distinct delegates who are from counties with population above 50000. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Count the number of distinct delegates who are from counties with population above 50000.` to a syntactically-correct PostgreSQL query.
| SELECT count(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population > 50000 |
What are the names of the county that the delegates on "Appropriations" committee belong to? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of the county that the delegates on "Appropriations" committee belong to?` to a syntactically-correct PostgreSQL query.
| SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = "Appropriations" |
Which county do the delegates on "Appropriations" committee belong to? Give me the county names. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which county do the delegates on "Appropriations" committee belong to? Give me the county names.` to a syntactically-correct PostgreSQL query.
| SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = "Appropriations" |
Show the delegates and the names of the party they belong to. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the delegates and the names of the party they belong to.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Delegate , T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID |
For each delegate, find the names of the party they are part of. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `For each delegate, find the names of the party they are part of.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Delegate , T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID |
Who were the governors of the parties associated with delegates from district 1? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Who were the governors of the parties associated with delegates from district 1?` to a syntactically-correct PostgreSQL query.
| SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 |
Find the parties associated with the delegates from district 1. Who served as governors of the parties? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the parties associated with the delegates from district 1. Who served as governors of the parties?` to a syntactically-correct PostgreSQL query.
| SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 |
Who were the comptrollers of the parties associated with the delegates from district 1 or district 2? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Who were the comptrollers of the parties associated with the delegates from district 1 or district 2?` to a syntactically-correct PostgreSQL query.
| 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 |
Find the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Find the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties?` to a syntactically-correct PostgreSQL query.
| 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 |
Return all the committees that have delegates from Democratic party. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Return all the committees that have delegates from Democratic party.` to a syntactically-correct PostgreSQL query.
| SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic" |
Which committees have delegates from the Democratic party? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which committees have delegates from the Democratic party?` to a syntactically-correct PostgreSQL query.
| SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = "Democratic" |
Show the name of each county along with the corresponding number of delegates from that county. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the name of each county along with the corresponding number of delegates from that county.` to a syntactically-correct PostgreSQL query.
| SELECT T1.County_name , COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id |
For each county, find the name of the county and the number of delegates from that county. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `For each county, find the name of the county and the number of delegates from that county.` to a syntactically-correct PostgreSQL query.
| SELECT T1.County_name , COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id |
Show the name of each party and the corresponding number of delegates from that party. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the name of each party and the corresponding number of delegates from that party.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Party , COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party |
For each party, return the name of the party and the number of delegates from that party. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `For each party, return the name of the party and the number of delegates from that party.` to a syntactically-correct PostgreSQL query.
| SELECT T2.Party , COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party |
Return the names of all counties sorted by population in ascending order. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Return the names of all counties sorted by population in ascending order.` to a syntactically-correct PostgreSQL query.
| SELECT County_name FROM county ORDER BY Population ASC |
Sort the names of all counties in ascending order of population. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Sort the names of all counties in ascending order of population.` to a syntactically-correct PostgreSQL query.
| SELECT County_name FROM county ORDER BY Population ASC |
Return the names of all counties sorted by county name in descending alphabetical order. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Return the names of all counties sorted by county name in descending alphabetical order.` to a syntactically-correct PostgreSQL query.
| SELECT County_name FROM county ORDER BY County_name DESC |
Sort the names of all counties in descending alphabetical order. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Sort the names of all counties in descending alphabetical order.` to a syntactically-correct PostgreSQL query.
| SELECT County_name FROM county ORDER BY County_name DESC |
Show the name of the county with the biggest population. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the name of the county with the biggest population.` to a syntactically-correct PostgreSQL query.
| SELECT County_name FROM county ORDER BY Population DESC LIMIT 1 |
Which county has the largest population? Give me the name of the county. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which county has the largest population? Give me the name of the county.` to a syntactically-correct PostgreSQL query.
| SELECT County_name FROM county ORDER BY Population DESC LIMIT 1 |
Show the 3 counties with the smallest population. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the 3 counties with the smallest population.` to a syntactically-correct PostgreSQL query.
| SELECT County_name FROM county ORDER BY Population ASC LIMIT 3 |
What are the 3 counties that have the smallest population? Give me the county names. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the 3 counties that have the smallest population? Give me the county names.` to a syntactically-correct PostgreSQL query.
| SELECT County_name FROM county ORDER BY Population ASC LIMIT 3 |
Show the names of counties that have at least two delegates. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the names of counties that have at least two delegates.` to a syntactically-correct PostgreSQL query.
| 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 |
Which counties have two or more delegates? Give me the county names. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which counties have two or more delegates? Give me the county names.` to a syntactically-correct PostgreSQL query.
| 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 |
Show the name of the party that has at least two records. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the name of the party that has at least two records.` to a syntactically-correct PostgreSQL query.
| SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2 |
Which party has two or more records? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which party has two or more records?` to a syntactically-correct PostgreSQL query.
| SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2 |
Show the name of the party that has the most delegates. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the name of the party that has the most delegates.` to a syntactically-correct PostgreSQL query.
| 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 |
Which party has the largest number of delegates? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which party has the largest number of delegates?` to a syntactically-correct PostgreSQL query.
| 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 |
Show the people that have been governor the most times. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the people that have been governor the most times.` to a syntactically-correct PostgreSQL query.
| SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1 |
Which people severed as governor most frequently? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which people severed as governor most frequently?` to a syntactically-correct PostgreSQL query.
| SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1 |
Show the people that have been comptroller the most times and the corresponding number of times. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Show the people that have been comptroller the most times and the corresponding number of times.` to a syntactically-correct PostgreSQL query.
| SELECT Comptroller , COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1 |
Which people severed as comptroller most frequently? Give me the name of the person and the frequency count. |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which people severed as comptroller most frequently? Give me the name of the person and the frequency count.` to a syntactically-correct PostgreSQL query.
| SELECT Comptroller , COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1 |
What are the names of parties that do not have delegates in election? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of parties that do not have delegates in election?` to a syntactically-correct PostgreSQL query.
| SELECT Party FROM party WHERE Party_ID NOT IN (SELECT Party FROM election) |
Which parties did not have any delegates in elections? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which parties did not have any delegates in elections?` to a syntactically-correct PostgreSQL query.
| SELECT Party FROM party WHERE Party_ID NOT IN (SELECT Party FROM election) |
What are the names of parties that have both delegates on "Appropriations" committee and |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `What are the names of parties that have both delegates on "Appropriations" committee and` to a syntactically-correct PostgreSQL query.
| 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" |
Which parties have delegates in both the "Appropriations" committee and the "Economic Matters" committee? |
-- Language PostgreSQL
-- Tables:
-- Table: county
columns : [['county id', 'number'], ['county name', 'text'], ['population', 'number'], ['zip code', 'text']]
-- Table: party
columns : [['party id', 'number'], ['year', 'number'], ['party', 'text'], ['governor', 'text'], ['lieutenant governor', 'text'], ['comptroller', 'text'], ['attorney general', 'text'], ['us senate', 'text']]
-- Table: election
columns : [['election id', 'number'], ['counties represented', 'text'], ['district', 'number'], ['delegate', 'text'], ['party', 'number'], ['first elected', 'number'], ['committee', 'text']]
You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL.
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.
Translate `Which parties have delegates in both the "Appropriations" committee and the "Economic Matters" committee?` to a syntactically-correct PostgreSQL query.
| 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" |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.