sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 festivals held in year 2007?
SQL: SELECT Festival_Name FROM festival_detail WHERE YEAR  =  2007
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 average number of audience for festivals?
SQL: SELECT avg(Num_of_Audience) FROM festival_detail
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 names of the three most recent festivals.
SQL: SELECT Festival_Name FROM festival_detail ORDER BY YEAR DESC LIMIT 3
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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: For each nomination, show the name of the artwork and name of the festival where it is nominated.
SQL: SELECT T2.Name ,  T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 distinct types of artworks that are nominated in festivals in 2007.
SQL: SELECT DISTINCT T2.Type FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID WHERE T3.Year  =  2007
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 names of artworks in ascending order of the year they are nominated in.
SQL: SELECT T2.Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID ORDER BY T3.Year
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 names of festivals that have nominated artworks of type "Program Talent Show".
SQL: SELECT T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID WHERE T2.Type  =  "Program Talent Show"
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 ids and names of festivals that have at least two nominations for artworks.
SQL: SELECT T1.Festival_ID ,  T3.Festival_Name FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID GROUP BY T1.Festival_ID HAVING COUNT(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 id, name of each festival and the number of artworks it has nominated.
SQL: SELECT T1.Festival_ID ,  T3.Festival_Name ,  COUNT(*) FROM nomination AS T1 JOIN artwork AS T2 ON T1.Artwork_ID  =  T2.Artwork_ID JOIN festival_detail AS T3 ON T1.Festival_ID  =  T3.Festival_ID GROUP BY T1.Festival_ID
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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: Please show different types of artworks with the corresponding number of artworks of each type.
SQL: SELECT TYPE ,  COUNT(*) FROM artwork GROUP BY TYPE
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 most common type of artworks.
SQL: SELECT TYPE FROM artwork GROUP BY TYPE ORDER BY COUNT(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 year in which there are more than one festivals.
SQL: SELECT YEAR FROM festival_detail GROUP BY YEAR HAVING COUNT(*)  >  1
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 name of artworks that are not nominated.
SQL: SELECT Name FROM Artwork WHERE Artwork_ID NOT IN (SELECT Artwork_ID FROM nomination)
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 number of audience in year 2008 or 2010.
SQL: SELECT Num_of_Audience FROM festival_detail WHERE YEAR  =  2008 OR YEAR  =  2010
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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 total number of the audiences who visited any of the festivals?
SQL: SELECT sum(Num_of_Audience) FROM festival_detail
-- Language PostgreSQL
        -- Tables: 
             -- Table: festival detail 
columns : [['festival id', 'number'], ['festival name', 'text'], ['chair name', 'text'], ['location', 'text'], ['year', 'number'], ['num of audience', 'number']]

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

 -- Table: nomination 
columns : [['artwork id', 'number'], ['festival id', 'number'], ['result', '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: In which year are there festivals both inside the 'United States' and outside the 'United States'?
SQL: SELECT YEAR FROM festival_detail WHERE LOCATION  =  'United States' INTERSECT SELECT YEAR FROM festival_detail WHERE LOCATION != 'United States'
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 premises are there?
SQL: SELECT count(*) FROM premises
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 all the distinct premise types?
SQL: SELECT DISTINCT premises_type FROM premises
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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: Find the types and details for all premises and order by the premise type.
SQL: SELECT premises_type ,  premise_details FROM premises ORDER BY premises_type
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 each premise type and the number of premises in that type.
SQL: SELECT premises_type ,  count(*) FROM premises GROUP BY premises_type
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 all distinct product categories along with the number of mailshots in each category.
SQL: SELECT product_category ,  count(*) FROM mailshot_campaigns GROUP BY product_category
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 name and phone of the customer without any mailshot.
SQL: SELECT customer_name ,  customer_phone FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM mailshot_customers)
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 name and phone for customers with a mailshot with outcome code 'No Response'.
SQL: SELECT T1.customer_name ,  T1.customer_phone FROM customers AS T1 JOIN mailshot_customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T2.outcome_code  =  'No Response'
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 outcome code of mailshots along with the number of mailshots in each outcome code.
SQL: SELECT outcome_code ,  count(*) FROM mailshot_customers GROUP BY outcome_code
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 names of customers who have at least 2 mailshots with outcome code 'Order'.
SQL: SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE outcome_code  =  'Order' GROUP BY T1.customer_id HAVING count(*)  >=  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 names of customers who have the most mailshots.
SQL: SELECT T2.customer_name FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 name and payment method of customers who have both mailshots in 'Order' outcome and mailshots in 'No Response' outcome.
SQL: SELECT T2.customer_name ,  T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.outcome_code  =  'Order' INTERSECT SELECT T2.customer_name ,  T2.payment_method FROM mailshot_customers AS T1 JOIN customers AS T2 ON T1.customer_id  =  T2.customer_id WHERE T1.outcome_code  =  'No Response'
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 premise type and address type code for all customer addresses.
SQL: SELECT T2.premises_type ,  T1.address_type_code FROM customer_addresses AS T1 JOIN premises AS T2 ON T1.premise_id  =  T2.premise_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 distinct address type codes for all customer addresses?
SQL: SELECT DISTINCT address_type_code FROM customer_addresses
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 shipping charge and customer id for customer orders with order status Cancelled or Paid.
SQL: SELECT order_shipping_charges ,  customer_id FROM customer_orders WHERE order_status_code  =  'Cancelled' OR order_status_code  =  'Paid'
-- Language PostgreSQL
        -- Tables: 
             -- Table: premises 
columns : [['premise id', 'number'], ['premises type', 'text'], ['premise details', 'text']]

 -- Table: products 
columns : [['product id', 'number'], ['product category', 'text'], ['product name', 'text']]

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['customer phone', 'text'], ['customer email', 'text'], ['customer address', 'text'], ['customer login', 'text'], ['customer password', 'text']]

 -- Table: mailshot campaigns 
columns : [['mailshot id', 'number'], ['product category', 'text'], ['mailshot name', 'text'], ['mailshot start date', 'time'], ['mailshot end date', 'time']]

 -- Table: customer addresses 
columns : [['customer id', 'number'], ['premise id', 'number'], ['date address from', 'time'], ['address type code', 'text'], ['date address to', 'time']]

 -- Table: customer orders 
columns : [['order id', 'number'], ['customer id', 'number'], ['order status code', 'text'], ['shipping method code', 'text'], ['order placed datetime', 'time'], ['order delivered datetime', 'time'], ['order shipping charges', 'text']]

 -- Table: mailshot customers 
columns : [['mailshot id', 'number'], ['customer id', 'number'], ['outcome code', 'text'], ['mailshot customer date', 'time']]

 -- Table: order items 
columns : [['item id', 'number'], ['order item status code', 'text'], ['order id', 'number'], ['product id', 'number'], ['item status code', 'text'], ['item delivered datetime', 'time'], ['item order quantity', '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 names of customers having an order with shipping method FedEx and order status Paid.
SQL: SELECT T1.customer_name FROM customers AS T1 JOIN customer_orders AS T2 ON T1.customer_id  =  T2.customer_id WHERE shipping_method_code  =  'FedEx' AND order_status_code  =  'Paid'