sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: customer master index 
columns : [['master customer id', 'number'], ['cmi details', 'text']]

 -- Table: cmi cross references 
columns : [['cmi cross reference id', 'number'], ['master customer id', 'number'], ['source system code', 'text']]

 -- Table: council tax 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: business rates 
columns : [['business rates id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: benefits overpayments 
columns : [['council tax id', 'number'], ['cmi cross ref id', 'number']]

 -- Table: parking fines 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: rent arrears 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: electoral register 
columns : [['electoral register id', 'number'], ['cmi cross reference id', '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 council tax ids and their related cmi cross references of all the parking fines.
SQL: SELECT council_tax_id ,  cmi_cross_ref_id FROM parking_fines
-- Language PostgreSQL
        -- Tables: 
             -- Table: customer master index 
columns : [['master customer id', 'number'], ['cmi details', 'text']]

 -- Table: cmi cross references 
columns : [['cmi cross reference id', 'number'], ['master customer id', 'number'], ['source system code', 'text']]

 -- Table: council tax 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: business rates 
columns : [['business rates id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: benefits overpayments 
columns : [['council tax id', 'number'], ['cmi cross ref id', 'number']]

 -- Table: parking fines 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: rent arrears 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: electoral register 
columns : [['electoral register id', 'number'], ['cmi cross reference id', '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 council taxes are collected for renting arrears ?
SQL: SELECT count(*) FROM rent_arrears
-- Language PostgreSQL
        -- Tables: 
             -- Table: customer master index 
columns : [['master customer id', 'number'], ['cmi details', 'text']]

 -- Table: cmi cross references 
columns : [['cmi cross reference id', 'number'], ['master customer id', 'number'], ['source system code', 'text']]

 -- Table: council tax 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: business rates 
columns : [['business rates id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: benefits overpayments 
columns : [['council tax id', 'number'], ['cmi cross ref id', 'number']]

 -- Table: parking fines 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: rent arrears 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: electoral register 
columns : [['electoral register id', 'number'], ['cmi cross reference id', '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 distinct cross reference source system codes which are related to the master customer details 'Gottlieb, Becker and Wyman'?
SQL: SELECT DISTINCT T2.source_system_code FROM customer_master_index AS T1 JOIN cmi_cross_references AS T2 ON T1.master_customer_id  =  T2.master_customer_id WHERE T1.cmi_details  =  'Gottlieb ,  Becker and Wyman'
-- Language PostgreSQL
        -- Tables: 
             -- Table: customer master index 
columns : [['master customer id', 'number'], ['cmi details', 'text']]

 -- Table: cmi cross references 
columns : [['cmi cross reference id', 'number'], ['master customer id', 'number'], ['source system code', 'text']]

 -- Table: council tax 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: business rates 
columns : [['business rates id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: benefits overpayments 
columns : [['council tax id', 'number'], ['cmi cross ref id', 'number']]

 -- Table: parking fines 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: rent arrears 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: electoral register 
columns : [['electoral register id', 'number'], ['cmi cross reference id', '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: Which cmi cross reference id is not related to any parking taxes?
SQL: SELECT cmi_cross_ref_id FROM cmi_cross_references EXCEPT SELECT cmi_cross_ref_id FROM parking_fines
-- Language PostgreSQL
        -- Tables: 
             -- Table: customer master index 
columns : [['master customer id', 'number'], ['cmi details', 'text']]

 -- Table: cmi cross references 
columns : [['cmi cross reference id', 'number'], ['master customer id', 'number'], ['source system code', 'text']]

 -- Table: council tax 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: business rates 
columns : [['business rates id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: benefits overpayments 
columns : [['council tax id', 'number'], ['cmi cross ref id', 'number']]

 -- Table: parking fines 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: rent arrears 
columns : [['council tax id', 'number'], ['cmi cross reference id', 'number']]

 -- Table: electoral register 
columns : [['electoral register id', 'number'], ['cmi cross reference id', '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: Which distinct source system code includes the substring 'en'?
SQL: SELECT DISTINCT source_system_code FROM cmi_cross_references WHERE source_system_code LIKE '%en%'
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 parties are there?
SQL: SELECT count(*) FROM party
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 parties.
SQL: SELECT count(*) FROM party
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 themes of parties in ascending order of number of hosts.
SQL: SELECT Party_Theme FROM party ORDER BY Number_of_hosts ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 themes of parties ordered by the number of hosts in ascending manner?
SQL: SELECT Party_Theme FROM party ORDER BY Number_of_hosts ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 themes and locations of parties?
SQL: SELECT Party_Theme ,  LOCATION FROM party
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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: Give me the theme and location of each party.
SQL: SELECT Party_Theme ,  LOCATION FROM party
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 first year and last year of parties with theme "Spring" or "Teqnology".
SQL: SELECT First_year ,  Last_year FROM party WHERE Party_Theme  =  "Spring" OR Party_Theme  =  "Teqnology"
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 first year and last year of the parties whose theme is "Spring" or "Teqnology"?
SQL: SELECT First_year ,  Last_year FROM party WHERE Party_Theme  =  "Spring" OR Party_Theme  =  "Teqnology"
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 average number of hosts for parties?
SQL: SELECT avg(Number_of_hosts) FROM party
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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: Compute the average number of hosts for parties.
SQL: SELECT avg(Number_of_hosts) FROM party
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 location of the party with the most hosts?
SQL: SELECT LOCATION FROM party ORDER BY Number_of_hosts DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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: Which party had the most hosts? Give me the party location.
SQL: SELECT LOCATION FROM party ORDER BY Number_of_hosts DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 different nationalities along with the number of hosts of each nationality.
SQL: SELECT Nationality ,  COUNT(*) FROM HOST GROUP BY Nationality
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 hosts does each nationality have? List the nationality and the count.
SQL: SELECT Nationality ,  COUNT(*) FROM HOST GROUP BY Nationality
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 most common nationality of hosts.
SQL: SELECT Nationality FROM HOST GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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: Which nationality has the most hosts?
SQL: SELECT Nationality FROM HOST GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 nations that have both hosts older than 45 and hosts younger than 35.
SQL: SELECT Nationality FROM HOST WHERE Age  >  45 INTERSECT SELECT Nationality FROM HOST WHERE Age  <  35
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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: Which nations have both hosts of age above 45 and hosts of age below 35?
SQL: SELECT Nationality FROM HOST WHERE Age  >  45 INTERSECT SELECT Nationality FROM HOST WHERE Age  <  35
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 themes of parties and the names of the party hosts.
SQL: SELECT T3.Party_Theme ,  T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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: For each party, return its theme and the name of its host.
SQL: SELECT T3.Party_Theme ,  T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 locations of parties and the names of the party hosts in ascending order of the age of the host.
SQL: SELECT T3.Location ,  T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID ORDER BY T2.Age
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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: For each party, find its location and the name of its host. Sort the result in ascending order of the age of the host.
SQL: SELECT T3.Location ,  T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID ORDER BY T2.Age
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 locations of parties with hosts older than 50.
SQL: SELECT T3.Location FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID WHERE T2.Age  >  50
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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: Which parties have hosts of age above 50? Give me the party locations.
SQL: SELECT T3.Location FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID WHERE T2.Age  >  50
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 host names for parties with number of hosts greater than 20.
SQL: SELECT T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID WHERE T3.Number_of_hosts  >  20
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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: Which parties have more than 20 hosts? Give me the host names for these parties.
SQL: SELECT T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID  =  T2.Host_ID JOIN party AS T3 ON T1.Party_ID  =  T3.Party_ID WHERE T3.Number_of_hosts  >  20
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 and the nationality of the oldest host.
SQL: SELECT Name ,  Nationality FROM HOST ORDER BY Age DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 the nationality of the host of the highest age?
SQL: SELECT Name ,  Nationality FROM HOST ORDER BY Age DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 names of hosts who did not serve as a host of any party in our record.
SQL: SELECT Name FROM HOST WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host)
-- Language PostgreSQL
        -- Tables: 
             -- Table: party 
columns : [['party id', 'number'], ['party theme', 'text'], ['location', 'text'], ['first year', 'text'], ['last year', 'text'], ['number of hosts', 'number']]

 -- Table: host 
columns : [['host id', 'number'], ['name', 'text'], ['nationality', 'text'], ['age', 'text']]

 -- Table: party host 
columns : [['party id', 'number'], ['host id', 'number'], ['is main in charge', 'others']]

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 hosts who did not host any party in our record?
SQL: SELECT Name FROM HOST WHERE Host_ID NOT IN (SELECT Host_ID FROM party_host)
-- 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 do we have?
SQL: SELECT count(*) FROM 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 regions.
SQL: SELECT count(*) FROM 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 all region code and region name sorted by the codes.
SQL: SELECT region_code ,  region_name FROM region ORDER BY region_code
-- 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 codes and names for all regions, sorted by codes?
SQL: SELECT region_code ,  region_name FROM region ORDER BY region_code
-- 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 all region names in alphabetical order.
SQL: SELECT region_name FROM region ORDER BY region_name
-- 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 regions in alphabetical order?
SQL: SELECT region_name FROM region ORDER BY region_name
-- 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 names for all regions except for Denmark.
SQL: SELECT region_name FROM region WHERE 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: Return the names of all regions other than Denmark.
SQL: SELECT region_name FROM region WHERE 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: How many storms had death records?
SQL: SELECT count(*) FROM storm WHERE Number_Deaths  >  0
-- 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 storms in which at least 1 person died.
SQL: SELECT count(*) FROM storm WHERE Number_Deaths  >  0
-- 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, dates active, and number of deaths for all storms with at least 1 death.
SQL: SELECT name ,  dates_active ,  number_deaths FROM storm WHERE number_deaths  >=  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, dates active, and number of deaths for storms that had 1 or more death?
SQL: SELECT name ,  dates_active ,  number_deaths FROM storm WHERE number_deaths  >=  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 average and maximum damage for all storms with max speed higher than 1000.
SQL: SELECT avg(damage_millions_USD) ,  max(damage_millions_USD) FROM storm WHERE max_speed  >  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.



Question: What is the average and maximum damage in millions for storms that had a max speed over 1000?
SQL: SELECT avg(damage_millions_USD) ,  max(damage_millions_USD) FROM storm WHERE max_speed  >  1000