sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: What are the hometowns of gymnasts and the corresponding number of gymnasts?
SQL: SELECT T2.Hometown ,  COUNT(*) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID GROUP BY T2.Hometown
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: How many gymnasts are from each hometown?
SQL: SELECT T2.Hometown ,  COUNT(*) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID GROUP BY T2.Hometown
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: What is the most common hometown of gymnasts?
SQL: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID GROUP BY T2.Hometown ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: Return the hometown that is most common among gymnasts.
SQL: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID GROUP BY T2.Hometown ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: What are the hometowns that are shared by at least two gymnasts?
SQL: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID GROUP BY T2.Hometown HAVING COUNT(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: Give the hometowns from which two or more gymnasts are from.
SQL: SELECT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID GROUP BY T2.Hometown HAVING COUNT(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: List the names of gymnasts in ascending order by their heights.
SQL: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID ORDER BY T2.Height ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: What are the names of gymnasts, ordered by their heights ascending?
SQL: SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID ORDER BY T2.Height ASC
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: List the distinct hometowns that are not associated with any gymnast.
SQL: SELECT DISTINCT Hometown FROM people EXCEPT SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: From which hometowns did no gymnasts come from?
SQL: SELECT DISTINCT Hometown FROM people EXCEPT SELECT DISTINCT T2.Hometown FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: Show the hometowns shared by people older than 23 and younger than 20.
SQL: SELECT Hometown FROM people WHERE Age  >  23 INTERSECT SELECT Hometown FROM people WHERE Age  <  20
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: From which hometowns did both people older than 23 and younger than 20 come from?
SQL: SELECT Hometown FROM people WHERE Age  >  23 INTERSECT SELECT Hometown FROM people WHERE Age  <  20
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: How many distinct hometowns did these people have?
SQL: SELECT count(DISTINCT Hometown) FROM people
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: Count the number of different hometowns of these people.
SQL: SELECT count(DISTINCT Hometown) FROM people
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: Show the ages of gymnasts in descending order of total points.
SQL: SELECT T2.Age FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID ORDER BY T1.Total_Points DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: gymnast 
columns : [['gymnast id', 'number'], ['floor exercise points', 'number'], ['pommel horse points', 'number'], ['rings points', 'number'], ['vault points', 'number'], ['parallel bars points', 'number'], ['horizontal bar points', 'number'], ['total points', 'number']]

 -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['age', 'number'], ['height', 'number'], ['hometown', 'text']]

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



Question: What are the ages of the gymnasts, ordered descending by their total points?
SQL: SELECT T2.Age FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID  =  T2.People_ID ORDER BY T1.Total_Points DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 savings balance of all accounts except the account with name ‘Brown’.
SQL: SELECT sum(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid WHERE T1.name != 'Brown'
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 balance of savings accounts not belonging to someone with the name Brown?
SQL: SELECT sum(T2.balance) FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid WHERE T1.name != 'Brown'
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 accounts are there in total?
SQL: SELECT count(*) FROM accounts
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 accounts.
SQL: SELECT count(*) FROM accounts
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 checking balance in all accounts?
SQL: SELECT sum(balance) FROM checking
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 balance across checking accounts.
SQL: SELECT sum(balance) FROM checking
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 checking balance.
SQL: SELECT avg(balance) FROM checking
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 balance in checking accounts?
SQL: SELECT avg(balance) FROM checking
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 accounts have a savings balance above the average savings balance?
SQL: SELECT count(*) FROM savings WHERE balance  >  (SELECT avg(balance) FROM savings)
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 accounts with a savings balance that is higher than the average savings balance.
SQL: SELECT count(*) FROM savings WHERE balance  >  (SELECT avg(balance) FROM savings)
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 id of accounts whose checking balance is below the maximum checking balance.
SQL: SELECT T1.custid ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  <  (SELECT max(balance) FROM checking)
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 customer id and name corresponding to accounts with a checking balance less than the largest checking balance?
SQL: SELECT T1.custid ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  <  (SELECT max(balance) FROM checking)
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 checking balance of the account whose owner’s name contains the substring ‘ee’?
SQL: SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T1.name LIKE '%ee%'
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 balance of the checking account belonging to an owner whose name contains 'ee'.
SQL: SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T1.name LIKE '%ee%'
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 checking balance and saving balance in the Brown’s account.
SQL: SELECT T2.balance ,  T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid WHERE T1.name  =  'Brown'
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 checking and savings balances in accounts belonging to Brown?
SQL: SELECT T2.balance ,  T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid WHERE T1.name  =  'Brown'
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', 'number']]

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



Question: Find the names of accounts whose checking balance is above the average checking balance, but savings balance is below the average savings balance.
SQL: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  >  (SELECT avg(balance) FROM checking) INTERSECT SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  <  (SELECT avg(balance) FROM savings)
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 accounts with checking balances greater than the average checking balance and savings balances below the average savings balance?
SQL: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  >  (SELECT avg(balance) FROM checking) INTERSECT SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  <  (SELECT avg(balance) FROM savings)
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 checking balance of the accounts whose savings balance is higher than the average savings balance.
SQL: SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T1.name IN (SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  >  (SELECT avg(balance) FROM savings))
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 balances of checking accounts belonging to people with savings balances greater than the average savings balance?
SQL: SELECT T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T1.name IN (SELECT T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  >  (SELECT avg(balance) FROM savings))
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', 'number']]

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



Question: List all customers’ names in the alphabetical order.
SQL: SELECT name FROM accounts ORDER BY name
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 the customers in alphabetical order?
SQL: SELECT name FROM accounts ORDER BY name
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 account that has the lowest total checking and saving balance.
SQL: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T2.balance + T3.balance LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 name corresponding to the accoung with the lowest sum of checking and savings balances?
SQL: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T2.balance + T3.balance LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', 'number']]

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



Question: Find the names and total checking and savings balances of accounts whose savings balance is higher than the average savings balance.
SQL: SELECT T1.name ,  T2.balance + T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid WHERE T3.balance  >  (SELECT avg(balance) FROM savings)
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 sum of checking and savings balances for accounts with savings balances higher than the average savings balance?
SQL: SELECT T1.name ,  T2.balance + T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid WHERE T3.balance  >  (SELECT avg(balance) FROM savings)
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 checking balance of the account with the lowest savings balance.
SQL: SELECT T1.name ,  T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T3.balance LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 balances of checking accounts belonging to the customer with the lowest savings balance?
SQL: SELECT T1.name ,  T2.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T3.balance LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 checking accounts for each account name.
SQL: SELECT count(*) ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid GROUP BY T1.name
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 accounts, and how many checking accounts do each of them have?
SQL: SELECT count(*) ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid GROUP BY T1.name
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 saving balance for each account name.
SQL: SELECT sum(T2.balance) ,  T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid GROUP BY T1.name
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 accounts, and what are the total savings balances for each?
SQL: SELECT sum(T2.balance) ,  T1.name FROM accounts AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid GROUP BY T1.name
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 accounts whose checking balance is below the average checking balance.
SQL: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  <  (SELECT avg(balance) FROM checking)
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 checking balances lower than the average checking balance?
SQL: SELECT T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid WHERE T2.balance  <  (SELECT avg(balance) FROM checking)
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 saving balance of the account with the highest checking balance.
SQL: SELECT T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T2.balance DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 savings balance of the account belonging to the customer with the highest checking balance?
SQL: SELECT T3.balance FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T2.balance DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 checking and saving balance of all accounts sorted by the total balance in ascending order.
SQL: SELECT T1.balance + T2.balance FROM checking AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid ORDER BY T1.balance + T2.balance
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 sum of checking and savings balances for all customers, ordered by the total balance?
SQL: SELECT T1.balance + T2.balance FROM checking AS T1 JOIN savings AS T2 ON T1.custid  =  T2.custid ORDER BY T1.balance + T2.balance
-- Language PostgreSQL
        -- Tables: 
             -- Table: accounts 
columns : [['customer id', 'number'], ['name', 'text']]

 -- Table: savings 
columns : [['customer id', 'number'], ['balance', 'number']]

 -- Table: checking 
columns : [['customer id', 'number'], ['balance', '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 checking balance of the account with the lowest saving balance.
SQL: SELECT T2.balance ,  T1.name FROM accounts AS T1 JOIN checking AS T2 ON T1.custid  =  T2.custid JOIN savings AS T3 ON T1.custid  =  T3.custid ORDER BY T3.balance LIMIT 1