sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: actor 
columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']]

 -- Table: address 
columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']]

 -- Table: category 
columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']]

 -- Table: city 
columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']]

 -- Table: country 
columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']]

 -- Table: customer 
columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']]

 -- Table: film 
columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']]

 -- Table: film actor 
columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']]

 -- Table: film category 
columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']]

 -- Table: film text 
columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']]

 -- Table: inventory 
columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']]

 -- Table: language 
columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']]

 -- Table: payment 
columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']]

 -- Table: rental 
columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']]

 -- Table: staff 
columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']]

 -- Table: store 
columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', 'time']]

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 largest payment amount?
SQL: SELECT amount FROM payment ORDER BY amount DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: actor 
columns : [['actor id', 'number'], ['first name', 'text'], ['last name', 'text'], ['last update', 'time']]

 -- Table: address 
columns : [['address id', 'number'], ['address', 'text'], ['address2', 'text'], ['district', 'text'], ['city id', 'number'], ['postal code', 'text'], ['phone', 'text'], ['last update', 'time']]

 -- Table: category 
columns : [['category id', 'number'], ['name', 'text'], ['last update', 'time']]

 -- Table: city 
columns : [['city id', 'number'], ['city', 'text'], ['country id', 'number'], ['last update', 'time']]

 -- Table: country 
columns : [['country id', 'number'], ['country', 'text'], ['last update', 'time']]

 -- Table: customer 
columns : [['customer id', 'number'], ['store id', 'number'], ['first name', 'text'], ['last name', 'text'], ['email', 'text'], ['address id', 'number'], ['active', 'boolean'], ['create date', 'time'], ['last update', 'time']]

 -- Table: film 
columns : [['film id', 'number'], ['title', 'text'], ['description', 'text'], ['release year', 'time'], ['language id', 'number'], ['original language id', 'number'], ['rental duration', 'number'], ['rental rate', 'number'], ['length', 'number'], ['replacement cost', 'number'], ['rating', 'text'], ['special features', 'text'], ['last update', 'time']]

 -- Table: film actor 
columns : [['actor id', 'number'], ['film id', 'number'], ['last update', 'time']]

 -- Table: film category 
columns : [['film id', 'number'], ['category id', 'number'], ['last update', 'time']]

 -- Table: film text 
columns : [['film id', 'number'], ['title', 'text'], ['description', 'text']]

 -- Table: inventory 
columns : [['inventory id', 'number'], ['film id', 'number'], ['store id', 'number'], ['last update', 'time']]

 -- Table: language 
columns : [['language id', 'number'], ['name', 'text'], ['last update', 'time']]

 -- Table: payment 
columns : [['payment id', 'number'], ['customer id', 'number'], ['staff id', 'number'], ['rental id', 'number'], ['amount', 'number'], ['payment date', 'time'], ['last update', 'time']]

 -- Table: rental 
columns : [['rental id', 'number'], ['rental date', 'time'], ['inventory id', 'number'], ['customer id', 'number'], ['return date', 'time'], ['staff id', 'number'], ['last update', 'time']]

 -- Table: staff 
columns : [['staff id', 'number'], ['first name', 'text'], ['last name', 'text'], ['address id', 'number'], ['picture', 'others'], ['email', 'text'], ['store id', 'number'], ['active', 'boolean'], ['username', 'text'], ['password', 'text'], ['last update', 'time']]

 -- Table: store 
columns : [['store id', 'number'], ['manager staff id', 'number'], ['address id', 'number'], ['last update', 'time']]

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 amount of the largest payment.
SQL: SELECT amount FROM payment ORDER BY amount DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 bank branches are there?
SQL: SELECT count(*) FROM bank
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 bank branches.
SQL: SELECT count(*) FROM bank
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 customers are there?
SQL: SELECT sum(no_of_customers) FROM bank
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the total number of customers across banks?
SQL: SELECT sum(no_of_customers) FROM bank
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the number of customers in the banks at New York City.
SQL: SELECT sum(no_of_customers) FROM bank WHERE city  =  'New York City'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What is the total number of customers who use banks in New York City?
SQL: SELECT sum(no_of_customers) FROM bank WHERE city  =  'New York City'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the average number of customers in all banks of Utah state.
SQL: SELECT avg(no_of_customers) FROM bank WHERE state  =  'Utah'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 number of customers across banks in the state of Utah?
SQL: SELECT avg(no_of_customers) FROM bank WHERE state  =  'Utah'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the average number of customers cross all banks.
SQL: SELECT avg(no_of_customers) FROM bank
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 number of bank customers?
SQL: SELECT avg(no_of_customers) FROM bank
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the city and state of the bank branch named morningside.
SQL: SELECT city ,  state FROM bank WHERE bname  =  'morningside'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 city and state is the bank with the name morningside in?
SQL: SELECT city ,  state FROM bank WHERE bname  =  'morningside'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the branch names of banks in the New York state.
SQL: SELECT bname FROM bank WHERE state  =  'New York'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 banks in the state of New York?
SQL: SELECT bname FROM bank WHERE state  =  'New York'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List the name of all customers sorted by their account balance in ascending order.
SQL: SELECT cust_name FROM customer ORDER BY acc_bal
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 all customers, ordered by account balance?
SQL: SELECT cust_name FROM customer ORDER BY acc_bal
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: List the name of all different customers who have some loan sorted by their total loan amount.
SQL: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id GROUP BY T1.cust_name ORDER BY sum(T2.amount)
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 different customers who have taken out a loan, ordered by the total amount that they have taken?
SQL: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id GROUP BY T1.cust_name ORDER BY sum(T2.amount)
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the state, account type, and credit score of the customer whose number of loan is 0.
SQL: SELECT state ,  acc_type ,  credit_score FROM customer WHERE no_of_loans  =  0
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 states, account types, and credit scores for customers who have 0 loans?
SQL: SELECT state ,  acc_type ,  credit_score FROM customer WHERE no_of_loans  =  0
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the number of different cities which banks are located at.
SQL: SELECT count(DISTINCT city) FROM bank
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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: In how many different cities are banks located?
SQL: SELECT count(DISTINCT city) FROM bank
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the number of different states which banks are located at.
SQL: SELECT count(DISTINCT state) FROM bank
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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: In how many different states are banks located?
SQL: SELECT count(DISTINCT state) FROM bank
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 distinct types of accounts are there?
SQL: SELECT count(DISTINCT acc_type) FROM customer
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Count the number of different account types.
SQL: SELECT count(DISTINCT acc_type) FROM customer
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the name and account balance of the customer whose name includes the letter ‘a’.
SQL: SELECT cust_name ,  acc_bal FROM customer WHERE cust_name LIKE '%a%'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: What are the names and account balances of customers with the letter a in their names?
SQL: SELECT cust_name ,  acc_bal FROM customer WHERE cust_name LIKE '%a%'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the total account balance of each customer from Utah or Texas.
SQL: SELECT sum(acc_bal) FROM customer WHERE state  =  'Utah' OR state  =  'Texas'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 account balances for each customer from Utah or Texas?
SQL: SELECT sum(acc_bal) FROM customer WHERE state  =  'Utah' OR state  =  'Texas'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the name of customers who have both saving and checking account types.
SQL: SELECT cust_name FROM customer WHERE acc_type  =  'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type  =  'checking'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 customers who have both savings and checking accounts?
SQL: SELECT cust_name FROM customer WHERE acc_type  =  'saving' INTERSECT SELECT cust_name FROM customer WHERE acc_type  =  'checking'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the name of customers who do not have an saving account.
SQL: SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type  =  'saving'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 customers who do not have saving accounts?
SQL: SELECT cust_name FROM customer EXCEPT SELECT cust_name FROM customer WHERE acc_type  =  'saving'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the name of customers who do not have a loan with a type of Mortgages.
SQL: SELECT cust_name FROM customer EXCEPT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id WHERE T2.loan_type  =  'Mortgages'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 customers who have not taken a Mortage loan?
SQL: SELECT cust_name FROM customer EXCEPT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id WHERE T2.loan_type  =  'Mortgages'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the name of customers who have loans of both Mortgages and Auto.
SQL: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id WHERE loan_type  =  'Mortgages' INTERSECT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id WHERE loan_type  =  'Auto'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 customers who have taken both Mortgage and Auto loans?
SQL: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id WHERE loan_type  =  'Mortgages' INTERSECT SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id WHERE loan_type  =  'Auto'
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', 'number']]

You are a SQL code translator. You have been given the Table data above. Your role is to translate natural language to PostgreSQL. 
You should not select columns that are not part of the tables provided to you. Think step by step.
Your only output should be SQL code. Do not include any other text. Only SQL code.



Question: Find the name of customers whose credit score is below the average credit scores of all customers.
SQL: SELECT cust_name FROM customer WHERE credit_score  <  (SELECT avg(credit_score) FROM customer)
-- Language PostgreSQL
        -- Tables: 
             -- Table: bank 
columns : [['branch id', 'number'], ['bname', 'text'], ['no of customers', 'number'], ['city', 'text'], ['state', 'text']]

 -- Table: customer 
columns : [['customer id', 'text'], ['customer name', 'text'], ['account type', 'text'], ['account balance', 'number'], ['number of loans', 'number'], ['credit score', 'number'], ['branch id', 'number'], ['state', 'text']]

 -- Table: loan 
columns : [['loan id', 'text'], ['loan type', 'text'], ['customer id', 'text'], ['branch id', 'text'], ['amount', '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 customers with credit score less than the average credit score across customers?
SQL: SELECT cust_name FROM customer WHERE credit_score  <  (SELECT avg(credit_score) FROM customer)