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

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

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

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

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

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

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

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

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

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



Question: Count the number of invoices.
SQL: SELECT count(*) FROM Invoices
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



Question: Show invoice dates and order id and details for all invoices.
SQL: SELECT T1.invoice_date ,  T1.order_id ,  T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id  =  T2.order_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



Question: What are the invoice dates, order ids, and order details for all invoices?
SQL: SELECT T1.invoice_date ,  T1.order_id ,  T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id  =  T2.order_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



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

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

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

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

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

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

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

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

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

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



Question: How many invoices correspond to each order id?
SQL: SELECT order_id ,  count(*) FROM Invoices GROUP BY order_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



Question: What is the order id and order details for the order more than two invoices.
SQL: SELECT T2.order_id ,  T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id  =  T2.order_id GROUP BY T2.order_id HAVING count(*)  >  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



Question: Return the order ids and details for orderes with two or more invoices.
SQL: SELECT T2.order_id ,  T2.order_details FROM Invoices AS T1 JOIN Orders AS T2 ON T1.order_id  =  T2.order_id GROUP BY T2.order_id HAVING count(*)  >  2
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



Question: What is the customer last name, id and phone number with most number of orders?
SQL: SELECT T2.customer_last_name ,  T1.customer_id ,  T2.phone_number FROM Orders 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: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



Question: Return the last name, id and phone number of the customer who has made the greatest number of orders.
SQL: SELECT T2.customer_last_name ,  T1.customer_id ,  T2.phone_number FROM Orders 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: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



Question: Show all product names without an order.
SQL: SELECT product_name FROM Products EXCEPT SELECT T1.product_name FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id  =  T2.product_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



Question: What are the names of products that have never been ordered?
SQL: SELECT product_name FROM Products EXCEPT SELECT T1.product_name FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id  =  T2.product_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



Question: Show all product names and the total quantity ordered for each product name.
SQL: SELECT T2.product_name ,  sum(T1.product_quantity) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id  =  T2.product_id GROUP BY T2.product_name
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



Question: What are the different product names, and what is the sum of quantity ordered for each product?
SQL: SELECT T2.product_name ,  sum(T1.product_quantity) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id  =  T2.product_id GROUP BY T2.product_name
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



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

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

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

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

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

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

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

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

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

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



Question: How many order items correspond to each order id?
SQL: SELECT order_id ,  count(*) FROM Order_items GROUP BY order_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



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

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

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

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

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

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

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

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

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

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



Question: How many distinct order ids correspond to each product?
SQL: SELECT product_id ,  count(DISTINCT order_id) FROM Order_items GROUP BY product_id
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



Question: Show all product names and the number of customers having an order on each product.
SQL: SELECT T2.product_name ,  count(*) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id  =  T2.product_id JOIN Orders AS T3 ON T3.order_id  =  T1.order_id GROUP BY T2.product_name
-- Language PostgreSQL
        -- Tables: 
             -- Table: customers 
columns : [['customer id', 'number'], ['customer first name', 'text'], ['customer middle initial', 'text'], ['customer last name', 'text'], ['gender', 'text'], ['email address', 'text'], ['login name', 'text'], ['login password', 'text'], ['phone number', 'text'], ['town city', 'text'], ['state county province', 'text'], ['country', 'text']]

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

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

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

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

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

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

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

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

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



Question: What are teh names of the different products, as well as the number of customers who have ordered each product.
SQL: SELECT T2.product_name ,  count(*) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id  =  T2.product_id JOIN Orders AS T3 ON T3.order_id  =  T1.order_id GROUP BY T2.product_name