sert121/SpiderSQL huggingface dataset:
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 is the total quantity of products purchased by "Rodrick Heaney"?
SQL: SELECT sum(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id WHERE t1.customer_name  =  "Rodrick Heaney"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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: Tell me the total quantity of products bought by the customer called "Rodrick Heaney".
SQL: SELECT sum(t3.order_quantity) FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id WHERE t1.customer_name  =  "Rodrick Heaney"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 customers have at least one order with status "Cancelled"?
SQL: SELECT count(DISTINCT customer_id) FROM customer_orders WHERE order_status  =  "Cancelled"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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: Return the number of customers who have at least one order with "Cancelled" status.
SQL: SELECT count(DISTINCT customer_id) FROM customer_orders WHERE order_status  =  "Cancelled"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 orders have detail "Second time"?
SQL: SELECT count(*) FROM customer_orders WHERE order_details  =  "Second time"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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: Tell me the number of orders with "Second time" as order detail.
SQL: SELECT count(*) FROM customer_orders WHERE order_details  =  "Second time"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 customer name and date of the orders that have the status "Delivered".
SQL: SELECT t1.customer_name ,  t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id WHERE order_status  =  "Delivered"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 customer name and date of the orders whose status is "Delivered".
SQL: SELECT t1.customer_name ,  t2.order_date FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id WHERE order_status  =  "Delivered"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 is the total number of products that are in orders with status "Cancelled"?
SQL: SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id  =  t2.order_id WHERE t1.order_status  =  "Cancelled"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 total quantity of products associated with the orders in the "Cancelled" status.
SQL: SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id  =  t2.order_id WHERE t1.order_status  =  "Cancelled"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 total amount of products ordered before 2018-03-17 07:13:53.
SQL: SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id  =  t2.order_id WHERE t1.order_date  <  "2018-03-17 07:13:53"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 is the total amount of products purchased before 2018-03-17 07:13:53?
SQL: SELECT sum(t2.order_quantity) FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id  =  t2.order_id WHERE t1.order_date  <  "2018-03-17 07:13:53"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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: Who made the latest order?
SQL: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id ORDER BY t2.order_date DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 name of the customer who made an order most recently.
SQL: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id ORDER BY t2.order_date DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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: Which product has been ordered most number of times?
SQL: SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id  =  t2.product_id GROUP BY t1.product_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 is the most frequently ordered product? Tell me the detail of the product
SQL: SELECT t2.product_details FROM order_items AS t1 JOIN products AS t2 ON t1.product_id  =  t2.product_id GROUP BY t1.product_id ORDER BY count(*) DESC LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 name and ID of the product whose total order quantity is the largest.
SQL: SELECT t2.product_details ,  t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id  =  t2.product_id GROUP BY t1.product_id ORDER BY sum(t1.order_quantity) LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 ID of the product bought the most.
SQL: SELECT t2.product_details ,  t2.product_id FROM order_items AS t1 JOIN products AS t2 ON t1.product_id  =  t2.product_id GROUP BY t1.product_id ORDER BY sum(t1.order_quantity) LIMIT 1
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 all the addresses in East Julianaside, Texas or in Gleasonmouth, Arizona.
SQL: SELECT address_content FROM addresses WHERE city  =  "East Julianaside" AND state_province_county  =  "Texas" UNION SELECT address_content FROM addresses WHERE city  =  "Gleasonmouth" AND state_province_county  =  "Arizona"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 addresses in East Julianaside, Texas or in Gleasonmouth, Arizona.
SQL: SELECT address_content FROM addresses WHERE city  =  "East Julianaside" AND state_province_county  =  "Texas" UNION SELECT address_content FROM addresses WHERE city  =  "Gleasonmouth" AND state_province_county  =  "Arizona"
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 name of customers who did not pay with Cash.
SQL: SELECT customer_name FROM customers WHERE payment_method != 'Cash'
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 is the name of customers who do not use Cash as payment method.
SQL: SELECT customer_name FROM customers WHERE payment_method != 'Cash'
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 names of customers who never ordered product Latte.
SQL: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE t4.product_details  =  'Latte'
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 names of customers who never ordered product Latte.
SQL: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE t4.product_details  =  'Latte'
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 names of customers who never placed an order.
SQL: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 names of customers who never made an order.
SQL: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: addresses 
columns : [['address id', 'number'], ['address content', 'text'], ['city', 'text'], ['zip postcode', 'text'], ['state province county', 'text'], ['country', 'text'], ['other address details', 'text']]

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

 -- Table: customers 
columns : [['customer id', 'number'], ['payment method', 'text'], ['customer name', 'text'], ['date became customer', 'time'], ['other customer details', 'text']]

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

 -- Table: customer contact channels 
columns : [['customer id', 'number'], ['channel code', 'text'], ['active from date', 'time'], ['active to date', 'time'], ['contact number', 'text']]

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

 -- Table: order items 
columns : [['order id', 'number'], ['product id', 'number'], ['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 names of customers who ordered both products Latte and Americano.
SQL: SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE t4.product_details  =  'Latte' INTERSECT SELECT t1.customer_name FROM customers AS t1 JOIN customer_orders AS t2 ON t1.customer_id  =  t2.customer_id JOIN order_items AS t3 ON t2.order_id  =  t3.order_id JOIN products AS t4 ON t3.product_id  =  t4.product_id WHERE t4.product_details  =  'Americano'