sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

 -- Table: orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']]

 -- Table: invoices 
columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']]

 -- Table: accounts 
columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']]

 -- Table: product categories 
columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']]

 -- Table: products 
columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']]

 -- Table: financial transactions 
columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']]

 -- Table: order items 
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']]

 -- Table: invoice line items 
columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', 'number']]

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



Question: Show order ids and the number of products in each order.
SQL: SELECT order_id ,  count(DISTINCT product_id) FROM Order_items GROUP BY order_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

 -- Table: orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']]

 -- Table: invoices 
columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']]

 -- Table: accounts 
columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']]

 -- Table: product categories 
columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']]

 -- Table: products 
columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']]

 -- Table: financial transactions 
columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']]

 -- Table: order items 
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']]

 -- Table: invoice line items 
columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 different products correspond to each order id?
SQL: SELECT order_id ,  count(DISTINCT product_id) FROM Order_items GROUP BY order_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

 -- Table: orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']]

 -- Table: invoices 
columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']]

 -- Table: accounts 
columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']]

 -- Table: product categories 
columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']]

 -- Table: products 
columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']]

 -- Table: financial transactions 
columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']]

 -- Table: order items 
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']]

 -- Table: invoice line items 
columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', 'number']]

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



Question: Show order ids and the total quantity in each order.
SQL: SELECT order_id ,  sum(product_quantity) FROM Order_items GROUP BY order_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

 -- Table: orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']]

 -- Table: invoices 
columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']]

 -- Table: accounts 
columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']]

 -- Table: product categories 
columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']]

 -- Table: products 
columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']]

 -- Table: financial transactions 
columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']]

 -- Table: order items 
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']]

 -- Table: invoice line items 
columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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: Give the order ids for all orders, as well as the total product quantity in each.
SQL: SELECT order_id ,  sum(product_quantity) FROM Order_items GROUP BY order_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

 -- Table: orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']]

 -- Table: invoices 
columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']]

 -- Table: accounts 
columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']]

 -- Table: product categories 
columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']]

 -- Table: products 
columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']]

 -- Table: financial transactions 
columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']]

 -- Table: order items 
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']]

 -- Table: invoice line items 
columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 products were not included in any order?
SQL: SELECT count(*) FROM products WHERE product_id NOT IN ( SELECT product_id FROM Order_items )
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

 -- Table: orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['date order placed', 'time'], ['order details', 'text']]

 -- Table: invoices 
columns : [['invoice number', 'number'], ['order id', 'number'], ['invoice date', 'time']]

 -- Table: accounts 
columns : [['account id', 'number'], ['customer id', 'number'], ['date account opened', 'time'], ['account name', 'text'], ['other account details', 'text']]

 -- Table: product categories 
columns : [['production type code', 'text'], ['product type description', 'text'], ['vat rating', 'number']]

 -- Table: products 
columns : [['product id', 'number'], ['parent product id', 'number'], ['production type code', 'text'], ['unit price', 'number'], ['product name', 'text'], ['product color', 'text'], ['product size', 'text']]

 -- Table: financial transactions 
columns : [['transaction id', 'number'], ['account id', 'number'], ['invoice number', 'number'], ['transaction type', 'text'], ['transaction date', 'time'], ['transaction amount', 'number'], ['transaction comment', 'text'], ['other transaction details', 'text']]

 -- Table: order items 
columns : [['order item id', 'number'], ['order id', 'number'], ['product id', 'number'], ['product quantity', 'text'], ['other order item details', 'text']]

 -- Table: invoice line items 
columns : [['order item id', 'number'], ['invoice number', 'number'], ['product id', 'number'], ['product title', 'text'], ['product quantity', 'text'], ['product price', 'number'], ['derived product cost', 'number'], ['derived vat payable', 'number'], ['derived total cost', '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 products that were never ordered.
SQL: SELECT count(*) FROM products WHERE product_id NOT IN ( SELECT product_id FROM Order_items )
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', '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 churches opened before 1850 are there?
SQL: SELECT count(*) FROM Church WHERE Open_Date  <  1850
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show the name, open date, and organizer for all churches.
SQL: SELECT name ,  open_date ,  organized_by FROM Church
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', '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 church names in descending order of opening date.
SQL: SELECT name FROM church ORDER BY open_date DESC
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show the opening year in whcih at least two churches opened.
SQL: SELECT open_date FROM church GROUP BY open_date HAVING count(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show the organizer and name for churches that opened between 1830 and 1840.
SQL: SELECT organized_by ,  name FROM church WHERE open_date BETWEEN 1830 AND 1840
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show all opening years and the number of churches that opened in that year.
SQL: SELECT open_date ,  count(*) FROM church GROUP BY open_date
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show the name and opening year for three churches that opened most recently.
SQL: SELECT name ,  open_date FROM church ORDER BY open_date DESC LIMIT 3
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', '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 female people are older than 30 in our record?
SQL: SELECT count(*) FROM people WHERE is_male  =  'F' AND age  >  30
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show the country where people older than 30 and younger than 25 are from.
SQL: SELECT country FROM people WHERE age  <  25 INTERSECT SELECT country FROM people WHERE age  >  30
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show the minimum, maximum, and average age for all people.
SQL: SELECT min(age) ,  max(age) ,  avg(age) FROM people
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show the name and country for all people whose age is smaller than the average.
SQL: SELECT name ,  country FROM people WHERE age  <  (SELECT avg(age) FROM people)
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show the pair of male and female names in all weddings after year 2014
SQL: SELECT T2.name ,  T3.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id  =  T2.people_id JOIN people AS T3 ON T1.female_id  =  T3.people_id WHERE T1.year  >  2014
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show the name and age for all male people who don't have a wedding.
SQL: SELECT name ,  age FROM people WHERE is_male  =  'T' AND people_id NOT IN (SELECT male_id FROM wedding)
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show all church names except for those that had a wedding in year 2015.
SQL: SELECT name FROM church EXCEPT SELECT T1.name FROM church AS T1 JOIN wedding AS T2 ON T1.church_id  =  T2.church_id WHERE T2.year  =  2015
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show all church names that have hosted least two weddings.
SQL: SELECT T1.name FROM church AS T1 JOIN wedding AS T2 ON T1.church_id  =  T2.church_id GROUP BY T1.church_id HAVING count(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show the names for all females from Canada having a wedding in year 2016.
SQL: SELECT T2.name FROM wedding AS T1 JOIN people AS T2 ON T1.female_id  =  T2.people_id WHERE T1.year  =  2016 AND T2.is_male  =  'F' AND T2.country  =  'Canada'
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', '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 weddings are there in year 2016?
SQL: SELECT count(*) FROM wedding WHERE YEAR  =  2016
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show the church names for the weddings of all people older than 30.
SQL: SELECT T4.name FROM wedding AS T1 JOIN people AS T2 ON T1.male_id  =  T2.people_id JOIN people AS T3 ON T1.female_id  =  T3.people_id JOIN church AS T4 ON T4.church_id  =  T1.church_id WHERE T2.age  >  30 OR T3.age  >  30
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', 'number']]

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



Question: Show all countries and the number of people from each country.
SQL: SELECT country ,  count(*) FROM people GROUP BY country
-- Language PostgreSQL
        -- Tables: 
             -- Table: people 
columns : [['people id', 'number'], ['name', 'text'], ['country', 'text'], ['is male', 'text'], ['age', 'number']]

 -- Table: church 
columns : [['church id', 'number'], ['name', 'text'], ['organized by', 'text'], ['open date', 'number'], ['continuation of', 'text']]

 -- Table: wedding 
columns : [['church id', 'number'], ['male id', 'number'], ['female id', 'number'], ['year', '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 churches have a wedding in year 2016?
SQL: SELECT COUNT (DISTINCT church_id) FROM wedding WHERE YEAR  =  2016
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 artists do we have?
SQL: SELECT count(*) FROM artist
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 artists.
SQL: SELECT count(*) FROM artist
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', 'number']]

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



Question: Show all artist name, age, and country ordered by the yeared they joined.
SQL: SELECT name ,  age ,  country FROM artist ORDER BY Year_Join
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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, ages, and countries of artists, sorted by the year they joined?
SQL: SELECT name ,  age ,  country FROM artist ORDER BY Year_Join
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 all distinct country for artists?
SQL: SELECT DISTINCT country FROM artist
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', 'number']]

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



Question: Return the different countries for artists.
SQL: SELECT DISTINCT country FROM artist
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', 'number']]

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



Question: Show all artist names and the year joined who are not from United States.
SQL: SELECT name ,  year_join FROM artist WHERE country != 'United States'
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 year of joining for artists that do not have the country "United States"?
SQL: SELECT name ,  year_join FROM artist WHERE country != 'United States'
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 artists are above age 46 and joined after 1990?
SQL: SELECT count(*) FROM artist WHERE age  >  46 AND year_join  >  1990
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 artists who are older than 46 and joined after 1990.
SQL: SELECT count(*) FROM artist WHERE age  >  46 AND year_join  >  1990
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', 'number']]

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



Question: What is the average and minimum age of all artists from United States.
SQL: SELECT avg(age) ,  min(age) FROM artist WHERE country  =  'United States'
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', 'number']]

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



Question: Return the average and minimum ages across artists from the United States.
SQL: SELECT avg(age) ,  min(age) FROM artist WHERE country  =  'United States'
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 of the artist who joined latest?
SQL: SELECT name FROM artist ORDER BY year_join DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', 'number']]

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



Question: Return the name of the artist who has the latest join year.
SQL: SELECT name FROM artist ORDER BY year_join DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 exhibition are there in year 2005 or after?
SQL: SELECT count(*) FROM exhibition WHERE YEAR  >=  2005
-- Language PostgreSQL
        -- Tables: 
             -- Table: artist 
columns : [['artist id', 'number'], ['name', 'text'], ['country', 'text'], ['year join', 'number'], ['age', 'number']]

 -- Table: exhibition 
columns : [['exhibition id', 'number'], ['year', 'number'], ['theme', 'text'], ['artist id', 'number'], ['ticket price', 'number']]

 -- Table: exhibition record 
columns : [['exhibition id', 'number'], ['date', 'text'], ['attendance', '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 exhibitions that happened in or after 2005.
SQL: SELECT count(*) FROM exhibition WHERE YEAR  >=  2005