sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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: A list of the top 10 countries by average invoice size. List country name and average invoice size.
SQL: SELECT billing_country ,  AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 names of the countries and average invoice size of the top countries by size?
SQL: SELECT billing_country ,  AVG(total) FROM invoices GROUP BY billing_country ORDER BY AVG(total) DESC LIMIT 10;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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: Find out 5 customers who most recently purchased something. List customers' first and last name.
SQL: SELECT T1.first_name ,  T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id ORDER BY T2.invoice_date DESC LIMIT 5;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 first and last names of the 5 customers who purchased something most recently?
SQL: SELECT T1.first_name ,  T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id ORDER BY T2.invoice_date DESC LIMIT 5;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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: Find out the top 10 customers by total number of orders. List customers' first and last name and the number of total orders.
SQL: SELECT T1.first_name ,  T1.last_name ,  COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 top 10 customers' first and last names by total number of orders and how many orders did they make?
SQL: SELECT T1.first_name ,  T1.last_name ,  COUNT(*) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id ORDER BY COUNT(*) DESC LIMIT 10;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 top 10 customers by total gross sales. List customers' first and last name and total gross sales.
SQL: SELECT T1.first_name ,  T1.last_name ,  SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 top 10 customers' first and last names with the highest gross sales, and also what are the sales?
SQL: SELECT T1.first_name ,  T1.last_name ,  SUM(T2.total) FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id GROUP BY T1.id ORDER BY SUM(T2.total) DESC LIMIT 10;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 top 5 genres by number of tracks. List genres name and total tracks.
SQL: SELECT T1.name ,  COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id  =  T1.id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 5;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 tracks does each genre have and what are the names of the top 5?
SQL: SELECT T1.name ,  COUNT(*) FROM genres AS T1 JOIN tracks AS T2 ON T2.genre_id  =  T1.id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 5;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 every album's title.
SQL: SELECT title FROM albums;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 titles of all the albums?
SQL: SELECT title FROM albums;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 every album ordered by album title in ascending order.
SQL: SELECT title FROM albums ORDER BY title;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 titles of all the albums alphabetically ascending?
SQL: SELECT title FROM albums ORDER BY title;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 every album whose title starts with A in alphabetical order.
SQL: SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 titles of all albums that start with A in alphabetical order?
SQL: SELECT title FROM albums WHERE title LIKE 'A%' ORDER BY title;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 customers first and last name of 10 least expensive invoices.
SQL: SELECT T1.first_name ,  T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id ORDER BY total LIMIT 10;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 first and last names of the customers with the 10 cheapest invoices?
SQL: SELECT T1.first_name ,  T1.last_name FROM customers AS T1 JOIN invoices AS T2 ON T2.customer_id  =  T1.id ORDER BY total LIMIT 10;
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 total amount of  invoice from Chicago, IL.
SQL: SELECT sum(total) FROM invoices WHERE billing_city  =  "Chicago" AND billing_state  =  "IL";
-- Language PostgreSQL
        -- Tables: 
             -- Table: sqlite sequence 
columns : [['name', 'number'], ['seq', 'text']]

 -- Table: artists 
columns : [['id', 'text'], ['name', 'text']]

 -- Table: albums 
columns : [['id', 'number'], ['title', 'text'], ['artist id', 'number']]

 -- Table: employees 
columns : [['id', 'number'], ['last name', 'text'], ['first name', 'text'], ['title', 'text'], ['reports to', 'number'], ['birth date', 'time'], ['hire date', 'time'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text']]

 -- Table: customers 
columns : [['id', 'number'], ['first name', 'text'], ['last name', 'text'], ['company', 'text'], ['address', 'text'], ['city', 'text'], ['state', 'text'], ['country', 'text'], ['postal code', 'text'], ['phone', 'text'], ['fax', 'text'], ['email', 'text'], ['support rep id', 'number']]

 -- Table: genres 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: invoices 
columns : [['id', 'number'], ['customer id', 'number'], ['invoice date', 'time'], ['billing address', 'text'], ['billing city', 'text'], ['billing state', 'text'], ['billing country', 'text'], ['billing postal code', 'text'], ['total', 'number']]

 -- Table: media types 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: tracks 
columns : [['id', 'number'], ['name', 'text'], ['album id', 'number'], ['media type id', 'number'], ['genre id', 'number'], ['composer', 'text'], ['milliseconds', 'number'], ['bytes', 'number'], ['unit price', 'number']]

 -- Table: invoice lines 
columns : [['id', 'number'], ['invoice id', 'number'], ['track id', 'number'], ['unit price', 'number'], ['quantity', 'number']]

 -- Table: playlists 
columns : [['id', 'number'], ['name', 'text']]

 -- Table: playlist tracks 
columns : [['playlist id', 'number'], ['track 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 total amount of money in the invoices billed from Chicago, Illinois?
SQL: SELECT sum(total) FROM invoices WHERE billing_city  =  "Chicago" AND billing_state  =  "IL";