brief_instruction
stringlengths
16
224
instruction
stringlengths
687
8.77k
output
stringlengths
18
577
Find the id of the customer who made the most orders.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Find the id of the customer who made the most orders.` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
Give me a list of id and status of orders which belong to the customer named "Jeramie".
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Give me a list of id and status of orders which belong to the customer named "Jeramie".` to a syntactically-correct PostgreSQL query.
SELECT T2.order_id , T2.order_status FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = "Jeramie"
Which orders are made by the customer named "Jeramie"? Give me the order ids and status.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Which orders are made by the customer named "Jeramie"? Give me the order ids and status.` to a syntactically-correct PostgreSQL query.
SELECT T2.order_id , T2.order_status FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = "Jeramie"
Find the dates of orders which belong to the customer named "Jeramie".
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Find the dates of orders which belong to the customer named "Jeramie".` to a syntactically-correct PostgreSQL query.
SELECT T2.date_order_placed FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = "Jeramie"
What are the dates of the orders made by the customer named "Jeramie"?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `What are the dates of the orders made by the customer named "Jeramie"?` to a syntactically-correct PostgreSQL query.
SELECT T2.date_order_placed FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T1.customer_name = "Jeramie"
Give me the names of customers who have placed orders between 2009-01-01 and 2010-01-01.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Give me the names of customers who have placed orders between 2009-01-01 and 2010-01-01.` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.date_order_placed >= "2009-01-01" AND T2.date_order_placed <= "2010-01-01"
Which customers made orders between 2009-01-01 and 2010-01-01? Find their names.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Which customers made orders between 2009-01-01 and 2010-01-01? Find their names.` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.date_order_placed >= "2009-01-01" AND T2.date_order_placed <= "2010-01-01"
Give me a list of distinct product ids from orders placed between 1975-01-01 and 1976-01-01?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Give me a list of distinct product ids from orders placed between 1975-01-01 and 1976-01-01?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T2.product_id FROM orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id WHERE T1.date_order_placed >= "1975-01-01" AND T1.date_order_placed <= "1976-01-01"
What are the distinct ids of products ordered between 1975-01-01 and 1976-01-01??
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `What are the distinct ids of products ordered between 1975-01-01 and 1976-01-01??` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T2.product_id FROM orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id WHERE T1.date_order_placed >= "1975-01-01" AND T1.date_order_placed <= "1976-01-01"
Find the names of the customers who have order status both "On Road" and "Shipped".
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Find the names of the customers who have order status both "On Road" and "Shipped".` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "On Road" INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Shipped"
Which customers have both "On Road" and "Shipped" as order status? List the customer names.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Which customers have both "On Road" and "Shipped" as order status? List the customer names.` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "On Road" INTERSECT SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Shipped"
Find the id of the customers who have order status both "On Road" and "Shipped".
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Find the id of the customers who have order status both "On Road" and "Shipped".` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "On Road" INTERSECT SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Shipped"
Which customers have both "On Road" and "Shipped" as order status? List the customer ids.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Which customers have both "On Road" and "Shipped" as order status? List the customer ids.` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "On Road" INTERSECT SELECT T1.customer_id FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id WHERE T2.order_status = "Shipped"
When was the order placed whose shipment tracking number is 3452? Give me the date.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `When was the order placed whose shipment tracking number is 3452? Give me the date.` to a syntactically-correct PostgreSQL query.
SELECT T1.date_order_placed FROM orders AS T1 JOIN shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.shipment_tracking_number = 3452
On which day was the order placed whose shipment tracking number is 3452?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `On which day was the order placed whose shipment tracking number is 3452?` to a syntactically-correct PostgreSQL query.
SELECT T1.date_order_placed FROM orders AS T1 JOIN shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.shipment_tracking_number = 3452
What is the placement date of the order whose invoice number is 10?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `What is the placement date of the order whose invoice number is 10?` to a syntactically-correct PostgreSQL query.
SELECT T1.date_order_placed FROM orders AS T1 JOIN shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.invoice_number = 10
On what day was the order with invoice number 10 placed?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `On what day was the order with invoice number 10 placed?` to a syntactically-correct PostgreSQL query.
SELECT T1.date_order_placed FROM orders AS T1 JOIN shipments AS T2 ON T1.order_id = T2.order_id WHERE T2.invoice_number = 10
List the count and id of each product in all the orders.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `List the count and id of each product in all the orders.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , T3.product_id FROM orders AS T1 JOIN order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id
For each product, return its id and the number of times it was ordered.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `For each product, return its id and the number of times it was ordered.` to a syntactically-correct PostgreSQL query.
SELECT count(*) , T3.product_id FROM orders AS T1 JOIN order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id
List the name and count of each product in all orders.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `List the name and count of each product in all orders.` to a syntactically-correct PostgreSQL query.
SELECT T3.product_name , count(*) FROM orders AS T1 JOIN order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id
For each product, show its name and the number of times it was ordered.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `For each product, show its name and the number of times it was ordered.` to a syntactically-correct PostgreSQL query.
SELECT T3.product_name , count(*) FROM orders AS T1 JOIN order_items AS T2 JOIN products AS T3 ON T1.order_id = T2.order_id AND T2.product_id = T3.product_id GROUP BY T3.product_id
Find the ids of orders which are shipped after 2000-01-01.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Find the ids of orders which are shipped after 2000-01-01.` to a syntactically-correct PostgreSQL query.
SELECT order_id FROM shipments WHERE shipment_date > "2000-01-01"
Which orders have shipment after 2000-01-01? Give me the order ids.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Which orders have shipment after 2000-01-01? Give me the order ids.` to a syntactically-correct PostgreSQL query.
SELECT order_id FROM shipments WHERE shipment_date > "2000-01-01"
Find the id of the order which is shipped most recently.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Find the id of the order which is shipped most recently.` to a syntactically-correct PostgreSQL query.
SELECT order_id FROM shipments WHERE shipment_date = (SELECT max(shipment_date) FROM shipments)
Which order has the most recent shipment? Give me the order id.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Which order has the most recent shipment? Give me the order id.` to a syntactically-correct PostgreSQL query.
SELECT order_id FROM shipments WHERE shipment_date = (SELECT max(shipment_date) FROM shipments)
List the names of all distinct products in alphabetical order.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `List the names of all distinct products in alphabetical order.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT product_name FROM products ORDER BY product_name
Sort all the distinct products in alphabetical order.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Sort all the distinct products in alphabetical order.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT product_name FROM products ORDER BY product_name
List the ids of all distinct orders ordered by placed date.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `List the ids of all distinct orders ordered by placed date.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT order_id FROM orders ORDER BY date_order_placed
What are ids of the all distinct orders, sorted by placement date?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `What are ids of the all distinct orders, sorted by placement date?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT order_id FROM orders ORDER BY date_order_placed
What is the id of the order which has the most items?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `What is the id of the order which has the most items?` to a syntactically-correct PostgreSQL query.
SELECT T1.order_id FROM orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id GROUP BY T1.order_id ORDER BY count(*) DESC LIMIT 1
Which order deals with the most items? Return the order id.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Which order deals with the most items? Return the order id.` to a syntactically-correct PostgreSQL query.
SELECT T1.order_id FROM orders AS T1 JOIN order_items AS T2 ON T1.order_id = T2.order_id GROUP BY T1.order_id ORDER BY count(*) DESC LIMIT 1
What is the name of the customer who has the largest number of orders?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `What is the name of the customer who has the largest number of orders?` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
Find the name of the customer who made the most orders.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Find the name of the customer who made the most orders.` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id ORDER BY count(*) DESC LIMIT 1
Find the invoice numbers which are created before 1989-09-03 or after 2007-12-25.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Find the invoice numbers which are created before 1989-09-03 or after 2007-12-25.` to a syntactically-correct PostgreSQL query.
SELECT invoice_number FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
What are the invoice numbers created before 1989-09-03 or after 2007-12-25?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `What are the invoice numbers created before 1989-09-03 or after 2007-12-25?` to a syntactically-correct PostgreSQL query.
SELECT invoice_number FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
Find the distinct details of invoices which are created before 1989-09-03 or after 2007-12-25.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Find the distinct details of invoices which are created before 1989-09-03 or after 2007-12-25.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT invoice_details FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
What are the distinct details of invoices created before 1989-09-03 or after 2007-12-25?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `What are the distinct details of invoices created before 1989-09-03 or after 2007-12-25?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT invoice_details FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
For each customer who has at least two orders, find the customer name and number of orders made.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `For each customer who has at least two orders, find the customer name and number of orders made.` to a syntactically-correct PostgreSQL query.
SELECT T2.customer_name , count(*) FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING count(*) >= 2
Which customers have made at least two orders? Give me each customer name and number of orders made.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Which customers have made at least two orders? Give me each customer name and number of orders made.` to a syntactically-correct PostgreSQL query.
SELECT T2.customer_name , count(*) FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING count(*) >= 2
Find the name of the customers who have at most two orders.
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Find the name of the customers who have at most two orders.` to a syntactically-correct PostgreSQL query.
SELECT T2.customer_name FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING count(*) <= 2
What are the names of the customers who have made two or less orders?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `What are the names of the customers who have made two or less orders?` to a syntactically-correct PostgreSQL query.
SELECT T2.customer_name FROM orders AS T1 JOIN customers AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.customer_id HAVING count(*) <= 2
List the names of the customers who have once bought product "food".
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `List the names of the customers who have once bought product "food".` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T4.product_name = "food" GROUP BY T1.customer_id HAVING count(*) >= 1
What are the names of the customers who bought product "food" at least once?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `What are the names of the customers who bought product "food" at least once?` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T4.product_name = "food" GROUP BY T1.customer_id HAVING count(*) >= 1
List the names of customers who have once canceled the purchase of the product "food" (the item status is "Cancel").
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `List the names of customers who have once canceled the purchase of the product "food" (the item status is "Cancel").` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T3.order_item_status = "Cancel" AND T4.product_name = "food" GROUP BY T1.customer_id HAVING count(*) >= 1
Which customers have ever canceled the purchase of the product "food" (the item status is "Cancel")?
-- Language PostgreSQL -- Tables: -- Table: customers columns : [['customer id', 'number'], ['customer name', 'text'], ['customer details', 'text']] -- Table: invoices columns : [['invoice number', 'number'], ['invoice date', 'time'], ['invoice details', 'text']] -- Table: orders columns : [['order id', 'number'], ['customer id', 'number'], ['order status', 'text'], ['date order placed', 'time'], ['order details', 'text']] -- Table: products columns : [['product id', 'number'], ['product name', 'text'], ['product details', 'text']] -- Table: order items columns : [['order item id', 'number'], ['product id', 'number'], ['order id', 'number'], ['order item status', 'text'], ['order item details', 'text']] -- Table: shipments columns : [['shipment id', 'number'], ['order id', 'number'], ['invoice number', 'number'], ['shipment tracking number', 'text'], ['shipment date', 'time'], ['other shipment details', 'text']] -- Table: shipment items columns : [['shipment id', 'number'], ['order item id', '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. Translate `Which customers have ever canceled the purchase of the product "food" (the item status is "Cancel")?` to a syntactically-correct PostgreSQL query.
SELECT T1.customer_name FROM customers AS T1 JOIN orders AS T2 JOIN order_items AS T3 JOIN products AS T4 ON T1.customer_id = T2.customer_id AND T2.order_id = T3.order_id AND T3.product_id = T4.product_id WHERE T3.order_item_status = "Cancel" AND T4.product_name = "food" GROUP BY T1.customer_id HAVING count(*) >= 1
How many architects are female?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `How many architects are female?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM architect WHERE gender = 'female'
List the name, nationality and id of all male architects ordered by their names lexicographically.
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `List the name, nationality and id of all male architects ordered by their names lexicographically.` to a syntactically-correct PostgreSQL query.
SELECT name , nationality , id FROM architect WHERE gender = 'male' ORDER BY name
What is the maximum length in meters for the bridges and what are the architects' names?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `What is the maximum length in meters for the bridges and what are the architects' names?` to a syntactically-correct PostgreSQL query.
SELECT max(T1.length_meters) , T2.name FROM bridge AS T1 JOIN architect AS T2 ON T1.architect_id = T2.id
What is the average length in feet of the bridges?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `What is the average length in feet of the bridges?` to a syntactically-correct PostgreSQL query.
SELECT avg(length_feet) FROM bridge
What are the names and year of construction for the mills of 'Grondzeiler' type?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `What are the names and year of construction for the mills of 'Grondzeiler' type?` to a syntactically-correct PostgreSQL query.
SELECT name , built_year FROM mill WHERE TYPE = 'Grondzeiler'
What are the distinct names and nationalities of the architects who have ever built a mill?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `What are the distinct names and nationalities of the architects who have ever built a mill?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.name , T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id = T2.architect_id
What are the names of the mills which are not located in 'Donceel'?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `What are the names of the mills which are not located in 'Donceel'?` to a syntactically-correct PostgreSQL query.
SELECT name FROM mill WHERE LOCATION != 'Donceel'
What are the distinct types of mills that are built by American or Canadian architects?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `What are the distinct types of mills that are built by American or Canadian architects?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.type FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id WHERE T2.nationality = 'American' OR T2.nationality = 'Canadian'
What are the ids and names of the architects who built at least 3 bridges ?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `What are the ids and names of the architects who built at least 3 bridges ?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.name FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) >= 3
What is the id, name and nationality of the architect who built most mills?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `What is the id, name and nationality of the architect who built most mills?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.name , T1.nationality FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
What are the ids, names and genders of the architects who built two bridges or one mill?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `What are the ids, names and genders of the architects who built two bridges or one mill?` to a syntactically-correct PostgreSQL query.
SELECT T1.id , T1.name , T1.gender FROM architect AS T1 JOIN bridge AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) = 2 UNION SELECT T1.id , T1.name , T1.gender FROM architect AS T1 JOIN mill AS T2 ON T1.id = T2.architect_id GROUP BY T1.id HAVING count(*) = 1
What is the location of the bridge named 'Kolob Arch' or 'Rainbow Bridge'?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `What is the location of the bridge named 'Kolob Arch' or 'Rainbow Bridge'?` to a syntactically-correct PostgreSQL query.
SELECT LOCATION FROM bridge WHERE name = 'Kolob Arch' OR name = 'Rainbow Bridge'
Which of the mill names contains the french word 'Moulin'?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `Which of the mill names contains the french word 'Moulin'?` to a syntactically-correct PostgreSQL query.
SELECT name FROM mill WHERE name LIKE '%Moulin%'
What are the distinct name of the mills built by the architects who have also built a bridge longer than 80 meters?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `What are the distinct name of the mills built by the architects who have also built a bridge longer than 80 meters?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT T1.name FROM mill AS T1 JOIN architect AS t2 ON T1.architect_id = T2.id JOIN bridge AS T3 ON T3.architect_id = T2.id WHERE T3.length_meters > 80
What is the most common mill type, and how many are there?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `What is the most common mill type, and how many are there?` to a syntactically-correct PostgreSQL query.
SELECT TYPE , count(*) FROM mill GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
How many architects haven't built a mill before year 1850?
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `How many architects haven't built a mill before year 1850?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM architect WHERE id NOT IN ( SELECT architect_id FROM mill WHERE built_year < 1850 );
show the name of all bridges that was designed by american archtect, and sort the result by the bridge feet length.
-- Language PostgreSQL -- Tables: -- Table: architect columns : [['id', 'text'], ['name', 'text'], ['nationality', 'text'], ['gender', 'text']] -- Table: bridge columns : [['architect id', 'number'], ['id', 'number'], ['name', 'text'], ['location', 'text'], ['length meters', 'number'], ['length feet', 'number']] -- Table: mill columns : [['architect id', 'number'], ['id', 'number'], ['location', 'text'], ['name', 'text'], ['type', 'text'], ['built year', 'number'], ['notes', '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. Translate `show the name of all bridges that was designed by american archtect, and sort the result by the bridge feet length.` to a syntactically-correct PostgreSQL query.
SELECT t1.name FROM bridge AS t1 JOIN architect AS t2 ON t1.architect_id = t2.id WHERE t2.nationality = 'American' ORDER BY t1.length_feet
How many book clubs are there?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `How many book clubs are there?` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM book_club
Count the number of book clubs.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Count the number of book clubs.` to a syntactically-correct PostgreSQL query.
SELECT count(*) FROM book_club
show the titles, and authors or editors for all books made after the year 1989.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `show the titles, and authors or editors for all books made after the year 1989.` to a syntactically-correct PostgreSQL query.
SELECT book_title , author_or_editor FROM book_club WHERE YEAR > 1989
What are the titles and authors or editors that correspond to books made after 1989?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `What are the titles and authors or editors that correspond to books made after 1989?` to a syntactically-correct PostgreSQL query.
SELECT book_title , author_or_editor FROM book_club WHERE YEAR > 1989
Show all distinct publishers for books.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Show all distinct publishers for books.` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT publisher FROM book_club
What are all the different book publishers?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `What are all the different book publishers?` to a syntactically-correct PostgreSQL query.
SELECT DISTINCT publisher FROM book_club
Show the years, book titles, and publishers for all books, in descending order by year.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Show the years, book titles, and publishers for all books, in descending order by year.` to a syntactically-correct PostgreSQL query.
SELECT YEAR , book_title , publisher FROM book_club ORDER BY YEAR DESC
What are the years, titles, and publishers for all books, ordered by year descending?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `What are the years, titles, and publishers for all books, ordered by year descending?` to a syntactically-correct PostgreSQL query.
SELECT YEAR , book_title , publisher FROM book_club ORDER BY YEAR DESC
Show all publishers and the number of books for each publisher.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Show all publishers and the number of books for each publisher.` to a syntactically-correct PostgreSQL query.
SELECT publisher , count(*) FROM book_club GROUP BY publisher
How many books are there for each publisher?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `How many books are there for each publisher?` to a syntactically-correct PostgreSQL query.
SELECT publisher , count(*) FROM book_club GROUP BY publisher
What is the publisher with most number of books?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `What is the publisher with most number of books?` to a syntactically-correct PostgreSQL query.
SELECT publisher FROM book_club GROUP BY publisher ORDER BY count(*) DESC LIMIT 1
Return the publisher that has published the most books.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Return the publisher that has published the most books.` to a syntactically-correct PostgreSQL query.
SELECT publisher FROM book_club GROUP BY publisher ORDER BY count(*) DESC LIMIT 1
Show all book categories and the number of books in each category.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Show all book categories and the number of books in each category.` to a syntactically-correct PostgreSQL query.
SELECT category , count(*) FROM book_club GROUP BY category
How many books fall into each category?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `How many books fall into each category?` to a syntactically-correct PostgreSQL query.
SELECT category , count(*) FROM book_club GROUP BY category
List categories that have at least two books after year 1989.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `List categories that have at least two books after year 1989.` to a syntactically-correct PostgreSQL query.
SELECT category FROM book_club WHERE YEAR > 1989 GROUP BY category HAVING count(*) >= 2
What categories have two or more corresponding books that were made after 1989?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `What categories have two or more corresponding books that were made after 1989?` to a syntactically-correct PostgreSQL query.
SELECT category FROM book_club WHERE YEAR > 1989 GROUP BY category HAVING count(*) >= 2
Show publishers with a book published in 1989 and a book in 1990.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Show publishers with a book published in 1989 and a book in 1990.` to a syntactically-correct PostgreSQL query.
SELECT publisher FROM book_club WHERE YEAR = 1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR = 1990
What are the publishers who have published a book in both 1989 and 1990?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `What are the publishers who have published a book in both 1989 and 1990?` to a syntactically-correct PostgreSQL query.
SELECT publisher FROM book_club WHERE YEAR = 1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR = 1990
Show all publishers which do not have a book in 1989.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Show all publishers which do not have a book in 1989.` to a syntactically-correct PostgreSQL query.
SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR = 1989
Which publishers did not publish a book in 1989?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Which publishers did not publish a book in 1989?` to a syntactically-correct PostgreSQL query.
SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR = 1989
Show all movie titles, years, and directors, ordered by budget.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Show all movie titles, years, and directors, ordered by budget.` to a syntactically-correct PostgreSQL query.
SELECT title , YEAR , director FROM movie ORDER BY budget_million
What are the titles, years, and directors of all movies, ordered by budget in millions?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `What are the titles, years, and directors of all movies, ordered by budget in millions?` to a syntactically-correct PostgreSQL query.
SELECT title , YEAR , director FROM movie ORDER BY budget_million
How many movie directors are there?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `How many movie directors are there?` to a syntactically-correct PostgreSQL query.
SELECT COUNT (DISTINCT director) FROM movie
Count the number of different directors.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Count the number of different directors.` to a syntactically-correct PostgreSQL query.
SELECT COUNT (DISTINCT director) FROM movie
What is the title and director for the movie with highest worldwide gross in the year 2000 or before?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `What is the title and director for the movie with highest worldwide gross in the year 2000 or before?` to a syntactically-correct PostgreSQL query.
SELECT title , director FROM movie WHERE YEAR <= 2000 ORDER BY gross_worldwide DESC LIMIT 1
Return the title and director of the movie released in the year 2000 or earlier that had the highest worldwide gross.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Return the title and director of the movie released in the year 2000 or earlier that had the highest worldwide gross.` to a syntactically-correct PostgreSQL query.
SELECT title , director FROM movie WHERE YEAR <= 2000 ORDER BY gross_worldwide DESC LIMIT 1
Show all director names who have a movie in both year 1999 and 2000.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Show all director names who have a movie in both year 1999 and 2000.` to a syntactically-correct PostgreSQL query.
SELECT director FROM movie WHERE YEAR = 2000 INTERSECT SELECT director FROM movie WHERE YEAR = 1999
Which directors had a movie both in the year 1999 and 2000?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Which directors had a movie both in the year 1999 and 2000?` to a syntactically-correct PostgreSQL query.
SELECT director FROM movie WHERE YEAR = 2000 INTERSECT SELECT director FROM movie WHERE YEAR = 1999
Show all director names who have a movie in the year 1999 or 2000.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Show all director names who have a movie in the year 1999 or 2000.` to a syntactically-correct PostgreSQL query.
SELECT director FROM movie WHERE YEAR = 1999 OR YEAR = 2000
Which directors had a movie in either 1999 or 2000?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Which directors had a movie in either 1999 or 2000?` to a syntactically-correct PostgreSQL query.
SELECT director FROM movie WHERE YEAR = 1999 OR YEAR = 2000
What is the average, maximum, and minimum budget for all movies before 2000.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `What is the average, maximum, and minimum budget for all movies before 2000.` to a syntactically-correct PostgreSQL query.
SELECT avg(budget_million) , max(budget_million) , min(budget_million) FROM movie WHERE YEAR < 2000
Return the average, maximum, and minimum budgets in millions for movies made before the year 2000.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Return the average, maximum, and minimum budgets in millions for movies made before the year 2000.` to a syntactically-correct PostgreSQL query.
SELECT avg(budget_million) , max(budget_million) , min(budget_million) FROM movie WHERE YEAR < 2000
List all company names with a book published by Alyson.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `List all company names with a book published by Alyson.` to a syntactically-correct PostgreSQL query.
SELECT T1.company_name FROM culture_company AS T1 JOIN book_club AS T2 ON T1.book_club_id = T2.book_club_id WHERE T2.publisher = 'Alyson'
What are all the company names that have a book published by Alyson?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `What are all the company names that have a book published by Alyson?` to a syntactically-correct PostgreSQL query.
SELECT T1.company_name FROM culture_company AS T1 JOIN book_club AS T2 ON T1.book_club_id = T2.book_club_id WHERE T2.publisher = 'Alyson'
Show the movie titles and book titles for all companies in China.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Show the movie titles and book titles for all companies in China.` to a syntactically-correct PostgreSQL query.
SELECT T1.title , T3.book_title FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id JOIN book_club AS T3 ON T3.book_club_id = T2.book_club_id WHERE T2.incorporated_in = 'China'
What are the titles of movies and books corresponding to companies incorporated in China?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `What are the titles of movies and books corresponding to companies incorporated in China?` to a syntactically-correct PostgreSQL query.
SELECT T1.title , T3.book_title FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id JOIN book_club AS T3 ON T3.book_club_id = T2.book_club_id WHERE T2.incorporated_in = 'China'
Show all company names with a movie directed in year 1999.
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `Show all company names with a movie directed in year 1999.` to a syntactically-correct PostgreSQL query.
SELECT T2.company_name FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id WHERE T1.year = 1999
What are all company names that have a corresponding movie directed in the year 1999?
-- Language PostgreSQL -- Tables: -- Table: book club columns : [['book club id', 'number'], ['year', 'number'], ['author or editor', 'text'], ['book title', 'text'], ['publisher', 'text'], ['category', 'text'], ['result', 'text']] -- Table: movie columns : [['movie id', 'number'], ['title', 'text'], ['year', 'number'], ['director', 'text'], ['budget million', 'number'], ['gross worldwide', 'number']] -- Table: culture company columns : [['company name', 'text'], ['type', 'text'], ['incorporated in', 'text'], ['group equity shareholding', 'number'], ['book club id', 'text'], ['movie id', '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. Translate `What are all company names that have a corresponding movie directed in the year 1999?` to a syntactically-correct PostgreSQL query.
SELECT T2.company_name FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id WHERE T1.year = 1999