sert121/SpiderSQL huggingface dataset:
-- 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.



Question: What is the total number of deaths and damage for all storms with a max speed greater than the average?
SQL: SELECT sum(number_deaths) ,  sum(damage_millions_USD) FROM storm WHERE max_speed  >  (SELECT avg(max_speed) FROM 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.



Question: Return the total number of deaths and total damange in millions for storms that had a max speed greater than the average.
SQL: SELECT sum(number_deaths) ,  sum(damage_millions_USD) FROM storm WHERE max_speed  >  (SELECT avg(max_speed) FROM 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.



Question: List name and damage for all storms in a descending order of max speed.
SQL: SELECT name ,  damage_millions_USD FROM storm ORDER BY max_speed DESC
-- 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.



Question: What are the names and damage in millions for storms, ordered by their max speeds descending?
SQL: SELECT name ,  damage_millions_USD FROM storm ORDER BY max_speed DESC
-- 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.



Question: How many regions are affected?
SQL: SELECT count(DISTINCT region_id) FROM affected_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.



Question: Count the number of different affected regions.
SQL: SELECT count(DISTINCT region_id) FROM affected_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.



Question: Show the name for regions not affected.
SQL: SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_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.



Question: What are the names of regions that were not affected?
SQL: SELECT region_name FROM region WHERE region_id NOT IN (SELECT region_id FROM affected_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.



Question: Show the name for regions and the number of storms for each region.
SQL: 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
-- 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.



Question: How many storms occured in each region?
SQL: 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
-- 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.



Question: List the name for storms and the number of affected regions for each storm.
SQL: 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
-- 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.



Question: How many regions were affected by each storm?
SQL: 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
-- 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.



Question: What is the storm name and max speed which affected the greatest number of regions?
SQL: 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
-- 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.



Question: Return the name and max speed of the storm that affected the most regions.
SQL: 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
-- 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.



Question: Show the name of storms which don't have affected region in record.
SQL: SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_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.



Question: What are the names of storms that did not affect any regions?
SQL: SELECT name FROM storm WHERE storm_id NOT IN (SELECT storm_id FROM affected_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.



Question: Show storm name with at least two regions and 10 cities affected.
SQL: 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
-- 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.



Question: What are the names of storms that both affected two or more regions and affected a total of 10 or more cities?
SQL: 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
-- 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.



Question: Show all storm names except for those with at least two affected regions.
SQL: 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
-- 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.



Question: What are the names of storms that did not affect two or more regions?
SQL: 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
-- 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.



Question: What are the region names affected by the storm with a number of deaths of least 10?
SQL: 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
-- 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.



Question: Return the names of the regions affected by storms that had a death count of at least 10.
SQL: 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
-- 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.



Question: Show all storm names affecting region "Denmark".
SQL: 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'
-- 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.



Question: What are the names of the storms that affected Denmark?
SQL: 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'
-- 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.



Question: Show the region name with at least two storms.
SQL: 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
-- 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.



Question: What are the names of regions with two or more storms?
SQL: 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
-- 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.



Question: Find the names of the regions which were affected by the storm that killed the greatest number of people.
SQL: 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
-- 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.



Question: What are the names of regions that were affected by the storm in which the most people died?
SQL: 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
-- 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.



Question: Find the name of the storm that affected both Afghanistan and Albania regions.
SQL: 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'
-- 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.



Question: What are the names of the storms that affected both the regions of Afghanistan and Albania?
SQL: 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'
-- 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.



Question: How many counties are there in total?
SQL: SELECT count(*) FROM 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.



Question: Count the total number of counties.
SQL: SELECT count(*) FROM 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.



Question: Show the county name and population of all counties.
SQL: SELECT County_name ,  Population FROM 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.



Question: What are the name and population of each county?
SQL: SELECT County_name ,  Population FROM 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.



Question: Show the average population of all counties.
SQL: SELECT avg(Population) FROM 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.



Question: On average how large is the population of the counties?
SQL: SELECT avg(Population) FROM 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.



Question: Return the maximum and minimum population among all counties.
SQL: SELECT max(Population) ,  min(Population) FROM 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.



Question: What are the maximum and minimum population of the counties?
SQL: SELECT max(Population) ,  min(Population) FROM 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.



Question: Show all the distinct districts for elections.
SQL: SELECT DISTINCT District FROM 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.



Question: What are the distinct districts for elections?
SQL: SELECT DISTINCT District FROM 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.



Question: Show the zip code of the county with name "Howard".
SQL: SELECT Zip_code FROM county WHERE County_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.



Question: What is the zip code the county named "Howard" is located in?
SQL: SELECT Zip_code FROM county WHERE County_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.



Question: Show the delegate from district 1 in election.
SQL: SELECT Delegate FROM election WHERE 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.



Question: Who is the delegate of district 1 in the elections?
SQL: SELECT Delegate FROM election WHERE 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.



Question: Show the delegate and committee information of elections.
SQL: SELECT Delegate ,  Committee FROM 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.



Question: What are the delegate and committee information for each election record?
SQL: SELECT Delegate ,  Committee FROM 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.



Question: How many distinct governors are there?
SQL: SELECT count(DISTINCT Governor) FROM party