db_id
stringclasses
140 values
schema
sequencelengths
0
26
question
stringlengths
16
224
query
stringlengths
18
577
query_toks
sequencelengths
4
90
query_toks_no_value
sequencelengths
4
125
question_toks
sequencelengths
4
44
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Find the id of the customer who made the most orders.
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
[ "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" ]
[ "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", "value" ]
[ "Find", "the", "id", "of", "the", "customer", "who", "made", "the", "most", "orders", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Give me a list of id and status of orders which belong to the customer named "Jeramie".
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "Give", "me", "a", "list", "of", "id", "and", "status", "of", "orders", "which", "belong", "to", "the", "customer", "named", "``", "Jeramie", "''", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Which orders are made by the customer named "Jeramie"? Give me the order ids and status.
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"
[ "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", "''" ]
[ "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", "=", "value" ]
[ "Which", "orders", "are", "made", "by", "the", "customer", "named", "``", "Jeramie", "''", "?", "Give", "me", "the", "order", "ids", "and", "status", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Find the dates of orders which belong to the customer named "Jeramie".
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"
[ "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", "''" ]
[ "select", "t2", ".", "date_order_placed", "from", "customers", "as", "t1", "join", "orders", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t1", ".", "customer_name", "=", "value" ]
[ "Find", "the", "dates", "of", "orders", "which", "belong", "to", "the", "customer", "named", "``", "Jeramie", "''", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
What are the dates of the orders made by the customer named "Jeramie"?
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"
[ "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", "''" ]
[ "select", "t2", ".", "date_order_placed", "from", "customers", "as", "t1", "join", "orders", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t1", ".", "customer_name", "=", "value" ]
[ "What", "are", "the", "dates", "of", "the", "orders", "made", "by", "the", "customer", "named", "``", "Jeramie", "''", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Give me the names of customers who have placed orders between 2009-01-01 and 2010-01-01.
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"
[ "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", "''" ]
[ "select", "t1", ".", "customer_name", "from", "customers", "as", "t1", "join", "orders", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t2", ".", "date_order_placed", ">", "=", "value", "and", "t2", ".", "date_order_placed", "<", "=", "value" ]
[ "Give", "me", "the", "names", "of", "customers", "who", "have", "placed", "orders", "between", "2009-01-01", "and", "2010-01-01", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Which customers made orders between 2009-01-01 and 2010-01-01? Find their names.
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"
[ "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", "''" ]
[ "select", "t1", ".", "customer_name", "from", "customers", "as", "t1", "join", "orders", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t2", ".", "date_order_placed", ">", "=", "value", "and", "t2", ".", "date_order_placed", "<", "=", "value" ]
[ "Which", "customers", "made", "orders", "between", "2009-01-01", "and", "2010-01-01", "?", "Find", "their", "names", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Give me a list of distinct product ids from orders placed between 1975-01-01 and 1976-01-01?
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"
[ "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", "''" ]
[ "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", ">", "=", "value", "and", "t1", ".", "date_order_placed", "<", "=", "value" ]
[ "Give", "me", "a", "list", "of", "distinct", "product", "ids", "from", "orders", "placed", "between", "1975-01-01", "and", "1976-01-01", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
What are the distinct ids of products ordered between 1975-01-01 and 1976-01-01??
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"
[ "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", "''" ]
[ "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", ">", "=", "value", "and", "t1", ".", "date_order_placed", "<", "=", "value" ]
[ "What", "are", "the", "distinct", "ids", "of", "products", "ordered", "between", "1975-01-01", "and", "1976-01-01", "?", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Find the names of the customers who have order status both "On Road" and "Shipped".
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"
[ "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", "''" ]
[ "select", "t1", ".", "customer_name", "from", "customers", "as", "t1", "join", "orders", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t2", ".", "order_status", "=", "value", "intersect", "select", "t1", ".", "customer_name", "from", "customers", "as", "t1", "join", "orders", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t2", ".", "order_status", "=", "value" ]
[ "Find", "the", "names", "of", "the", "customers", "who", "have", "order", "status", "both", "``", "On", "Road", "''", "and", "``", "Shipped", "''", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Which customers have both "On Road" and "Shipped" as order status? List the customer names.
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"
[ "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", "''" ]
[ "select", "t1", ".", "customer_name", "from", "customers", "as", "t1", "join", "orders", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t2", ".", "order_status", "=", "value", "intersect", "select", "t1", ".", "customer_name", "from", "customers", "as", "t1", "join", "orders", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t2", ".", "order_status", "=", "value" ]
[ "Which", "customers", "have", "both", "``", "On", "Road", "''", "and", "``", "Shipped", "''", "as", "order", "status", "?", "List", "the", "customer", "names", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Find the id of the customers who have order status both "On Road" and "Shipped".
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"
[ "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", "''" ]
[ "select", "t1", ".", "customer_id", "from", "customers", "as", "t1", "join", "orders", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t2", ".", "order_status", "=", "value", "intersect", "select", "t1", ".", "customer_id", "from", "customers", "as", "t1", "join", "orders", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t2", ".", "order_status", "=", "value" ]
[ "Find", "the", "id", "of", "the", "customers", "who", "have", "order", "status", "both", "``", "On", "Road", "''", "and", "``", "Shipped", "''", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Which customers have both "On Road" and "Shipped" as order status? List the customer ids.
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"
[ "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", "''" ]
[ "select", "t1", ".", "customer_id", "from", "customers", "as", "t1", "join", "orders", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t2", ".", "order_status", "=", "value", "intersect", "select", "t1", ".", "customer_id", "from", "customers", "as", "t1", "join", "orders", "as", "t2", "on", "t1", ".", "customer_id", "=", "t2", ".", "customer_id", "where", "t2", ".", "order_status", "=", "value" ]
[ "Which", "customers", "have", "both", "``", "On", "Road", "''", "and", "``", "Shipped", "''", "as", "order", "status", "?", "List", "the", "customer", "ids", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
When was the order placed whose shipment tracking number is 3452? Give me the date.
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
[ "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" ]
[ "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", "=", "value" ]
[ "When", "was", "the", "order", "placed", "whose", "shipment", "tracking", "number", "is", "3452", "?", "Give", "me", "the", "date", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
On which day was the order placed whose shipment tracking number is 3452?
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
[ "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" ]
[ "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", "=", "value" ]
[ "On", "which", "day", "was", "the", "order", "placed", "whose", "shipment", "tracking", "number", "is", "3452", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
What is the placement date of the order whose invoice number is 10?
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
[ "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" ]
[ "select", "t1", ".", "date_order_placed", "from", "orders", "as", "t1", "join", "shipments", "as", "t2", "on", "t1", ".", "order_id", "=", "t2", ".", "order_id", "where", "t2", ".", "invoice_number", "=", "value" ]
[ "What", "is", "the", "placement", "date", "of", "the", "order", "whose", "invoice", "number", "is", "10", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
On what day was the order with invoice number 10 placed?
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
[ "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" ]
[ "select", "t1", ".", "date_order_placed", "from", "orders", "as", "t1", "join", "shipments", "as", "t2", "on", "t1", ".", "order_id", "=", "t2", ".", "order_id", "where", "t2", ".", "invoice_number", "=", "value" ]
[ "On", "what", "day", "was", "the", "order", "with", "invoice", "number", "10", "placed", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
List the count and id of each product in all the orders.
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
[ "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" ]
[ "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", "count", "and", "id", "of", "each", "product", "in", "all", "the", "orders", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
For each product, return its id and the number of times it was ordered.
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
[ "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" ]
[ "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", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
List the name and count of each product in all orders.
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
[ "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" ]
[ "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" ]
[ "List", "the", "name", "and", "count", "of", "each", "product", "in", "all", "orders", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
For each product, show its name and the number of times it was ordered.
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
[ "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" ]
[ "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", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Find the ids of orders which are shipped after 2000-01-01.
SELECT order_id FROM shipments WHERE shipment_date > "2000-01-01"
[ "SELECT", "order_id", "FROM", "shipments", "WHERE", "shipment_date", ">", "``", "2000-01-01", "''" ]
[ "select", "order_id", "from", "shipments", "where", "shipment_date", ">", "value" ]
[ "Find", "the", "ids", "of", "orders", "which", "are", "shipped", "after", "2000-01-01", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Which orders have shipment after 2000-01-01? Give me the order ids.
SELECT order_id FROM shipments WHERE shipment_date > "2000-01-01"
[ "SELECT", "order_id", "FROM", "shipments", "WHERE", "shipment_date", ">", "``", "2000-01-01", "''" ]
[ "select", "order_id", "from", "shipments", "where", "shipment_date", ">", "value" ]
[ "Which", "orders", "have", "shipment", "after", "2000-01-01", "?", "Give", "me", "the", "order", "ids", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Find the id of the order which is shipped most recently.
SELECT order_id FROM shipments WHERE shipment_date = (SELECT max(shipment_date) FROM shipments)
[ "SELECT", "order_id", "FROM", "shipments", "WHERE", "shipment_date", "=", "(", "SELECT", "max", "(", "shipment_date", ")", "FROM", "shipments", ")" ]
[ "select", "order_id", "from", "shipments", "where", "shipment_date", "=", "(", "select", "max", "(", "shipment_date", ")", "from", "shipments", ")" ]
[ "Find", "the", "id", "of", "the", "order", "which", "is", "shipped", "most", "recently", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Which order has the most recent shipment? Give me the order id.
SELECT order_id FROM shipments WHERE shipment_date = (SELECT max(shipment_date) FROM shipments)
[ "SELECT", "order_id", "FROM", "shipments", "WHERE", "shipment_date", "=", "(", "SELECT", "max", "(", "shipment_date", ")", "FROM", "shipments", ")" ]
[ "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", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
List the names of all distinct products in alphabetical order.
SELECT DISTINCT product_name FROM products ORDER BY product_name
[ "SELECT", "DISTINCT", "product_name", "FROM", "products", "ORDER", "BY", "product_name" ]
[ "select", "distinct", "product_name", "from", "products", "order", "by", "product_name" ]
[ "List", "the", "names", "of", "all", "distinct", "products", "in", "alphabetical", "order", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Sort all the distinct products in alphabetical order.
SELECT DISTINCT product_name FROM products ORDER BY product_name
[ "SELECT", "DISTINCT", "product_name", "FROM", "products", "ORDER", "BY", "product_name" ]
[ "select", "distinct", "product_name", "from", "products", "order", "by", "product_name" ]
[ "Sort", "all", "the", "distinct", "products", "in", "alphabetical", "order", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
List the ids of all distinct orders ordered by placed date.
SELECT DISTINCT order_id FROM orders ORDER BY date_order_placed
[ "SELECT", "DISTINCT", "order_id", "FROM", "orders", "ORDER", "BY", "date_order_placed" ]
[ "select", "distinct", "order_id", "from", "orders", "order", "by", "date_order_placed" ]
[ "List", "the", "ids", "of", "all", "distinct", "orders", "ordered", "by", "placed", "date", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
What are ids of the all distinct orders, sorted by placement date?
SELECT DISTINCT order_id FROM orders ORDER BY date_order_placed
[ "SELECT", "DISTINCT", "order_id", "FROM", "orders", "ORDER", "BY", "date_order_placed" ]
[ "select", "distinct", "order_id", "from", "orders", "order", "by", "date_order_placed" ]
[ "What", "are", "ids", "of", "the", "all", "distinct", "orders", ",", "sorted", "by", "placement", "date", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
What is the id of the order which has the most items?
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
[ "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" ]
[ "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", "value" ]
[ "What", "is", "the", "id", "of", "the", "order", "which", "has", "the", "most", "items", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Which order deals with the most items? Return the order id.
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
[ "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" ]
[ "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", "value" ]
[ "Which", "order", "deals", "with", "the", "most", "items", "?", "Return", "the", "order", "id", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
What is the name of the customer who has the largest number of orders?
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
[ "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" ]
[ "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", "value" ]
[ "What", "is", "the", "name", "of", "the", "customer", "who", "has", "the", "largest", "number", "of", "orders", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Find the name of the customer who made the most orders.
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
[ "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" ]
[ "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", "value" ]
[ "Find", "the", "name", "of", "the", "customer", "who", "made", "the", "most", "orders", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Find the invoice numbers which are created before 1989-09-03 or after 2007-12-25.
SELECT invoice_number FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
[ "SELECT", "invoice_number", "FROM", "invoices", "WHERE", "invoice_date", "<", "``", "1989-09-03", "''", "OR", "invoice_date", ">", "``", "2007-12-25", "''" ]
[ "select", "invoice_number", "from", "invoices", "where", "invoice_date", "<", "value", "or", "invoice_date", ">", "value" ]
[ "Find", "the", "invoice", "numbers", "which", "are", "created", "before", "1989-09-03", "or", "after", "2007-12-25", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
What are the invoice numbers created before 1989-09-03 or after 2007-12-25?
SELECT invoice_number FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
[ "SELECT", "invoice_number", "FROM", "invoices", "WHERE", "invoice_date", "<", "``", "1989-09-03", "''", "OR", "invoice_date", ">", "``", "2007-12-25", "''" ]
[ "select", "invoice_number", "from", "invoices", "where", "invoice_date", "<", "value", "or", "invoice_date", ">", "value" ]
[ "What", "are", "the", "invoice", "numbers", "created", "before", "1989-09-03", "or", "after", "2007-12-25", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Find the distinct details of invoices which are created before 1989-09-03 or after 2007-12-25.
SELECT DISTINCT invoice_details FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
[ "SELECT", "DISTINCT", "invoice_details", "FROM", "invoices", "WHERE", "invoice_date", "<", "``", "1989-09-03", "''", "OR", "invoice_date", ">", "``", "2007-12-25", "''" ]
[ "select", "distinct", "invoice_details", "from", "invoices", "where", "invoice_date", "<", "value", "or", "invoice_date", ">", "value" ]
[ "Find", "the", "distinct", "details", "of", "invoices", "which", "are", "created", "before", "1989-09-03", "or", "after", "2007-12-25", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
What are the distinct details of invoices created before 1989-09-03 or after 2007-12-25?
SELECT DISTINCT invoice_details FROM invoices WHERE invoice_date < "1989-09-03" OR invoice_date > "2007-12-25"
[ "SELECT", "DISTINCT", "invoice_details", "FROM", "invoices", "WHERE", "invoice_date", "<", "``", "1989-09-03", "''", "OR", "invoice_date", ">", "``", "2007-12-25", "''" ]
[ "select", "distinct", "invoice_details", "from", "invoices", "where", "invoice_date", "<", "value", "or", "invoice_date", ">", "value" ]
[ "What", "are", "the", "distinct", "details", "of", "invoices", "created", "before", "1989-09-03", "or", "after", "2007-12-25", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
For each customer who has at least two orders, find the customer name and number of orders made.
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
[ "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" ]
[ "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", "(", "*", ")", ">", "=", "value" ]
[ "For", "each", "customer", "who", "has", "at", "least", "two", "orders", ",", "find", "the", "customer", "name", "and", "number", "of", "orders", "made", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Which customers have made at least two orders? Give me each customer name and number of orders made.
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
[ "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" ]
[ "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", "(", "*", ")", ">", "=", "value" ]
[ "Which", "customers", "have", "made", "at", "least", "two", "orders", "?", "Give", "me", "each", "customer", "name", "and", "number", "of", "orders", "made", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Find the name of the customers who have at most two orders.
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
[ "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" ]
[ "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", "(", "*", ")", "<", "=", "value" ]
[ "Find", "the", "name", "of", "the", "customers", "who", "have", "at", "most", "two", "orders", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
What are the names of the customers who have made two or less orders?
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
[ "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" ]
[ "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", "(", "*", ")", "<", "=", "value" ]
[ "What", "are", "the", "names", "of", "the", "customers", "who", "have", "made", "two", "or", "less", "orders", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
List the names of the customers who have once bought product "food".
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
[ "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" ]
[ "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", "=", "value", "group", "by", "t1", ".", "customer_id", "having", "count", "(", "*", ")", ">", "=", "value" ]
[ "List", "the", "names", "of", "the", "customers", "who", "have", "once", "bought", "product", "``", "food", "''", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
What are the names of the customers who bought product "food" at least once?
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
[ "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" ]
[ "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", "=", "value", "group", "by", "t1", ".", "customer_id", "having", "count", "(", "*", ")", ">", "=", "value" ]
[ "What", "are", "the", "names", "of", "the", "customers", "who", "bought", "product", "``", "food", "''", "at", "least", "once", "?" ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
List the names of customers who have once canceled the purchase of the product "food" (the item status is "Cancel").
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
[ "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" ]
[ "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", "=", "value", "and", "t4", ".", "product_name", "=", "value", "group", "by", "t1", ".", "customer_id", "having", "count", "(", "*", ")", ">", "=", "value" ]
[ "List", "the", "names", "of", "customers", "who", "have", "once", "canceled", "the", "purchase", "of", "the", "product", "``", "food", "''", "(", "the", "item", "status", "is", "``", "Cancel", "''", ")", "." ]
tracking_orders
[ "CREATE TABLE `Customers` (\n`customer_id` INTEGER PRIMARY KEY,\n`customer_name` VARCHAR(80),\n`customer_details` VARCHAR(255)\n);", "CREATE TABLE `Invoices` (\n`invoice_number` INTEGER PRIMARY KEY,\n`invoice_date` DATETIME,\n`invoice_details` VARCHAR(255)\n);", "CREATE TABLE `Orders` (\n`order_id` INTEGER PRIMARY KEY,\n`customer_id` INTEGER NOT NULL,\n`order_status` VARCHAR(10) NOT NULL,\n`date_order_placed` DATETIME NOT NULL,\n`order_details` VARCHAR(255),\nFOREIGN KEY (`customer_id` ) REFERENCES `Customers`(`customer_id` )\n);", "CREATE TABLE `Products` (\n`product_id` INTEGER PRIMARY KEY,\n`product_name` VARCHAR(80),\n`product_details` VARCHAR(255)\n);", "CREATE TABLE `Order_Items` (\n`order_item_id` INTEGER PRIMARY KEY,\n`product_id` INTEGER NOT NULL,\n`order_id` INTEGER NOT NULL,\n`order_item_status` VARCHAR(10) NOT NULL,\n`order_item_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`product_id` ) REFERENCES `Products`(`product_id` )\n);", "CREATE TABLE `Shipments` (\n`shipment_id` INTEGER PRIMARY KEY,\n`order_id` INTEGER NOT NULL,\n`invoice_number` INTEGER NOT NULL,\n`shipment_tracking_number` VARCHAR(80),\n`shipment_date` DATETIME,\n`other_shipment_details` VARCHAR(255),\nFOREIGN KEY (`order_id` ) REFERENCES `Orders`(`order_id` ),\nFOREIGN KEY (`invoice_number` ) REFERENCES `Invoices`(`invoice_number` )\n);", "CREATE TABLE `Shipment_Items` (\n`shipment_id` INTEGER NOT NULL,\n`order_item_id` INTEGER NOT NULL,\nFOREIGN KEY (`order_item_id` ) REFERENCES `Order_Items`(`order_item_id` ),\nFOREIGN KEY (`shipment_id` ) REFERENCES `Shipments`(`shipment_id` )\n);" ]
Which customers have ever canceled the purchase of the product "food" (the item status is "Cancel")?
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
[ "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" ]
[ "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", "=", "value", "and", "t4", ".", "product_name", "=", "value", "group", "by", "t1", ".", "customer_id", "having", "count", "(", "*", ")", ">", "=", "value" ]
[ "Which", "customers", "have", "ever", "canceled", "the", "purchase", "of", "the", "product", "``", "food", "''", "(", "the", "item", "status", "is", "``", "Cancel", "''", ")", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
How many architects are female?
SELECT count(*) FROM architect WHERE gender = 'female'
[ "SELECT", "count", "(", "*", ")", "FROM", "architect", "WHERE", "gender", "=", "'female", "'" ]
[ "select", "count", "(", "*", ")", "from", "architect", "where", "gender", "=", "value" ]
[ "How", "many", "architects", "are", "female", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
List the name, nationality and id of all male architects ordered by their names lexicographically.
SELECT name , nationality , id FROM architect WHERE gender = 'male' ORDER BY name
[ "SELECT", "name", ",", "nationality", ",", "id", "FROM", "architect", "WHERE", "gender", "=", "'male", "'", "ORDER", "BY", "name" ]
[ "select", "name", ",", "nationality", ",", "id", "from", "architect", "where", "gender", "=", "value", "order", "by", "name" ]
[ "List", "the", "name", ",", "nationality", "and", "id", "of", "all", "male", "architects", "ordered", "by", "their", "names", "lexicographically", "." ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
What is the maximum length in meters for the bridges and what are the architects' names?
SELECT max(T1.length_meters) , T2.name FROM bridge AS T1 JOIN architect AS T2 ON T1.architect_id = T2.id
[ "SELECT", "max", "(", "T1.length_meters", ")", ",", "T2.name", "FROM", "bridge", "AS", "T1", "JOIN", "architect", "AS", "T2", "ON", "T1.architect_id", "=", "T2.id" ]
[ "select", "max", "(", "t1", ".", "length_meters", ")", ",", "t2", ".", "name", "from", "bridge", "as", "t1", "join", "architect", "as", "t2", "on", "t1", ".", "architect_id", "=", "t2", ".", "id" ]
[ "What", "is", "the", "maximum", "length", "in", "meters", "for", "the", "bridges", "and", "what", "are", "the", "architects", "'", "names", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
What is the average length in feet of the bridges?
SELECT avg(length_feet) FROM bridge
[ "SELECT", "avg", "(", "length_feet", ")", "FROM", "bridge" ]
[ "select", "avg", "(", "length_feet", ")", "from", "bridge" ]
[ "What", "is", "the", "average", "length", "in", "feet", "of", "the", "bridges", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
What are the names and year of construction for the mills of 'Grondzeiler' type?
SELECT name , built_year FROM mill WHERE TYPE = 'Grondzeiler'
[ "SELECT", "name", ",", "built_year", "FROM", "mill", "WHERE", "TYPE", "=", "'Grondzeiler", "'" ]
[ "select", "name", ",", "built_year", "from", "mill", "where", "type", "=", "value" ]
[ "What", "are", "the", "names", "and", "year", "of", "construction", "for", "the", "mills", "of", "'Grondzeiler", "'", "type", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
What are the distinct names and nationalities of the architects who have ever built a mill?
SELECT DISTINCT T1.name , T1.nationality FROM architect AS T1 JOIN mill AS t2 ON T1.id = T2.architect_id
[ "SELECT", "DISTINCT", "T1.name", ",", "T1.nationality", "FROM", "architect", "AS", "T1", "JOIN", "mill", "AS", "t2", "ON", "T1.id", "=", "T2.architect_id" ]
[ "select", "distinct", "t1", ".", "name", ",", "t1", ".", "nationality", "from", "architect", "as", "t1", "join", "mill", "as", "t2", "on", "t1", ".", "id", "=", "t2", ".", "architect_id" ]
[ "What", "are", "the", "distinct", "names", "and", "nationalities", "of", "the", "architects", "who", "have", "ever", "built", "a", "mill", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
What are the names of the mills which are not located in 'Donceel'?
SELECT name FROM mill WHERE LOCATION != 'Donceel'
[ "SELECT", "name", "FROM", "mill", "WHERE", "LOCATION", "!", "=", "'Donceel", "'" ]
[ "select", "name", "from", "mill", "where", "location", "!", "=", "value" ]
[ "What", "are", "the", "names", "of", "the", "mills", "which", "are", "not", "located", "in", "'Donceel", "'", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
What are the distinct types of mills that are built by American or Canadian architects?
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'
[ "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", "'" ]
[ "select", "distinct", "t1", ".", "type", "from", "mill", "as", "t1", "join", "architect", "as", "t2", "on", "t1", ".", "architect_id", "=", "t2", ".", "id", "where", "t2", ".", "nationality", "=", "value", "or", "t2", ".", "nationality", "=", "value" ]
[ "What", "are", "the", "distinct", "types", "of", "mills", "that", "are", "built", "by", "American", "or", "Canadian", "architects", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
What are the ids and names of the architects who built at least 3 bridges ?
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
[ "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" ]
[ "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", "(", "*", ")", ">", "=", "value" ]
[ "What", "are", "the", "ids", "and", "names", "of", "the", "architects", "who", "built", "at", "least", "3", "bridges", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
What is the id, name and nationality of the architect who built most mills?
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
[ "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" ]
[ "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", "value" ]
[ "What", "is", "the", "id", ",", "name", "and", "nationality", "of", "the", "architect", "who", "built", "most", "mills", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
What are the ids, names and genders of the architects who built two bridges or one mill?
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
[ "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" ]
[ "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", "(", "*", ")", "=", "value", "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", "(", "*", ")", "=", "value" ]
[ "What", "are", "the", "ids", ",", "names", "and", "genders", "of", "the", "architects", "who", "built", "two", "bridges", "or", "one", "mill", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
What is the location of the bridge named 'Kolob Arch' or 'Rainbow Bridge'?
SELECT LOCATION FROM bridge WHERE name = 'Kolob Arch' OR name = 'Rainbow Bridge'
[ "SELECT", "LOCATION", "FROM", "bridge", "WHERE", "name", "=", "'Kolob", "Arch", "'", "OR", "name", "=", "'Rainbow", "Bridge", "'" ]
[ "select", "location", "from", "bridge", "where", "name", "=", "value", "or", "name", "=", "value" ]
[ "What", "is", "the", "location", "of", "the", "bridge", "named", "'Kolob", "Arch", "'", "or", "'Rainbow", "Bridge", "'", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
Which of the mill names contains the french word 'Moulin'?
SELECT name FROM mill WHERE name LIKE '%Moulin%'
[ "SELECT", "name", "FROM", "mill", "WHERE", "name", "LIKE", "'", "%", "Moulin", "%", "'" ]
[ "select", "name", "from", "mill", "where", "name", "like", "value" ]
[ "Which", "of", "the", "mill", "names", "contains", "the", "french", "word", "'Moulin", "'", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
What are the distinct name of the mills built by the architects who have also built a bridge longer than 80 meters?
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
[ "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" ]
[ "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", ">", "value" ]
[ "What", "are", "the", "distinct", "name", "of", "the", "mills", "built", "by", "the", "architects", "who", "have", "also", "built", "a", "bridge", "longer", "than", "80", "meters", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
What is the most common mill type, and how many are there?
SELECT TYPE , count(*) FROM mill GROUP BY TYPE ORDER BY count(*) DESC LIMIT 1
[ "SELECT", "TYPE", ",", "count", "(", "*", ")", "FROM", "mill", "GROUP", "BY", "TYPE", "ORDER", "BY", "count", "(", "*", ")", "DESC", "LIMIT", "1" ]
[ "select", "type", ",", "count", "(", "*", ")", "from", "mill", "group", "by", "type", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "What", "is", "the", "most", "common", "mill", "type", ",", "and", "how", "many", "are", "there", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
How many architects haven't built a mill before year 1850?
SELECT count(*) FROM architect WHERE id NOT IN ( SELECT architect_id FROM mill WHERE built_year < 1850 );
[ "SELECT", "count", "(", "*", ")", "FROM", "architect", "WHERE", "id", "NOT", "IN", "(", "SELECT", "architect_id", "FROM", "mill", "WHERE", "built_year", "<", "1850", ")", ";" ]
[ "select", "count", "(", "*", ")", "from", "architect", "where", "id", "not", "in", "(", "select", "architect_id", "from", "mill", "where", "built_year", "<", "value", ")" ]
[ "How", "many", "architects", "have", "n't", "built", "a", "mill", "before", "year", "1850", "?" ]
architecture
[ "CREATE TABLE \"architect\" (\n\"id\" text,\n\"name\" text,\n\"nationality\" text,\n\"gender\" text,\nprimary key(\"id\")\n);", "CREATE TABLE \"bridge\" (\n\"architect_id\" int,\n\"id\" int,\n\"name\" text,\n\"location\" text,\n\"length_meters\" real,\n\"length_feet\" real,\nprimary key(\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);", "CREATE TABLE \"mill\" (\n\"architect_id\" int,\n\"id\" int,\n\"location\" text,\n\"name\" text,\n\"type\" text,\n\"built_year\" int,\n\"notes\" text,\nprimary key (\"id\"),\nforeign key (\"architect_id\" ) references `architect`(\"id\")\n);" ]
show the name of all bridges that was designed by american archtect, and sort the result by the bridge feet length.
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
[ "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" ]
[ "select", "t1", ".", "name", "from", "bridge", "as", "t1", "join", "architect", "as", "t2", "on", "t1", ".", "architect_id", "=", "t2", ".", "id", "where", "t2", ".", "nationality", "=", "value", "order", "by", "t1", ".", "length_feet" ]
[ "show", "the", "name", "of", "all", "bridges", "that", "was", "designed", "by", "american", "archtect", ",", "and", "sort", "the", "result", "by", "the", "bridge", "feet", "length", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
How many book clubs are there?
SELECT count(*) FROM book_club
[ "SELECT", "count", "(", "*", ")", "FROM", "book_club" ]
[ "select", "count", "(", "*", ")", "from", "book_club" ]
[ "How", "many", "book", "clubs", "are", "there", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Count the number of book clubs.
SELECT count(*) FROM book_club
[ "SELECT", "count", "(", "*", ")", "FROM", "book_club" ]
[ "select", "count", "(", "*", ")", "from", "book_club" ]
[ "Count", "the", "number", "of", "book", "clubs", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
show the titles, and authors or editors for all books made after the year 1989.
SELECT book_title , author_or_editor FROM book_club WHERE YEAR > 1989
[ "SELECT", "book_title", ",", "author_or_editor", "FROM", "book_club", "WHERE", "YEAR", ">", "1989" ]
[ "select", "book_title", ",", "author_or_editor", "from", "book_club", "where", "year", ">", "value" ]
[ "show", "the", "titles", ",", "and", "authors", "or", "editors", "for", "all", "books", "made", "after", "the", "year", "1989", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
What are the titles and authors or editors that correspond to books made after 1989?
SELECT book_title , author_or_editor FROM book_club WHERE YEAR > 1989
[ "SELECT", "book_title", ",", "author_or_editor", "FROM", "book_club", "WHERE", "YEAR", ">", "1989" ]
[ "select", "book_title", ",", "author_or_editor", "from", "book_club", "where", "year", ">", "value" ]
[ "What", "are", "the", "titles", "and", "authors", "or", "editors", "that", "correspond", "to", "books", "made", "after", "1989", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Show all distinct publishers for books.
SELECT DISTINCT publisher FROM book_club
[ "SELECT", "DISTINCT", "publisher", "FROM", "book_club" ]
[ "select", "distinct", "publisher", "from", "book_club" ]
[ "Show", "all", "distinct", "publishers", "for", "books", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
What are all the different book publishers?
SELECT DISTINCT publisher FROM book_club
[ "SELECT", "DISTINCT", "publisher", "FROM", "book_club" ]
[ "select", "distinct", "publisher", "from", "book_club" ]
[ "What", "are", "all", "the", "different", "book", "publishers", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Show the years, book titles, and publishers for all books, in descending order by year.
SELECT YEAR , book_title , publisher FROM book_club ORDER BY YEAR DESC
[ "SELECT", "YEAR", ",", "book_title", ",", "publisher", "FROM", "book_club", "ORDER", "BY", "YEAR", "DESC" ]
[ "select", "year", ",", "book_title", ",", "publisher", "from", "book_club", "order", "by", "year", "desc" ]
[ "Show", "the", "years", ",", "book", "titles", ",", "and", "publishers", "for", "all", "books", ",", "in", "descending", "order", "by", "year", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
What are the years, titles, and publishers for all books, ordered by year descending?
SELECT YEAR , book_title , publisher FROM book_club ORDER BY YEAR DESC
[ "SELECT", "YEAR", ",", "book_title", ",", "publisher", "FROM", "book_club", "ORDER", "BY", "YEAR", "DESC" ]
[ "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", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Show all publishers and the number of books for each publisher.
SELECT publisher , count(*) FROM book_club GROUP BY publisher
[ "SELECT", "publisher", ",", "count", "(", "*", ")", "FROM", "book_club", "GROUP", "BY", "publisher" ]
[ "select", "publisher", ",", "count", "(", "*", ")", "from", "book_club", "group", "by", "publisher" ]
[ "Show", "all", "publishers", "and", "the", "number", "of", "books", "for", "each", "publisher", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
How many books are there for each publisher?
SELECT publisher , count(*) FROM book_club GROUP BY publisher
[ "SELECT", "publisher", ",", "count", "(", "*", ")", "FROM", "book_club", "GROUP", "BY", "publisher" ]
[ "select", "publisher", ",", "count", "(", "*", ")", "from", "book_club", "group", "by", "publisher" ]
[ "How", "many", "books", "are", "there", "for", "each", "publisher", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
What is the publisher with most number of books?
SELECT publisher FROM book_club GROUP BY publisher ORDER BY count(*) DESC LIMIT 1
[ "SELECT", "publisher", "FROM", "book_club", "GROUP", "BY", "publisher", "ORDER", "BY", "count", "(", "*", ")", "DESC", "LIMIT", "1" ]
[ "select", "publisher", "from", "book_club", "group", "by", "publisher", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "What", "is", "the", "publisher", "with", "most", "number", "of", "books", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Return the publisher that has published the most books.
SELECT publisher FROM book_club GROUP BY publisher ORDER BY count(*) DESC LIMIT 1
[ "SELECT", "publisher", "FROM", "book_club", "GROUP", "BY", "publisher", "ORDER", "BY", "count", "(", "*", ")", "DESC", "LIMIT", "1" ]
[ "select", "publisher", "from", "book_club", "group", "by", "publisher", "order", "by", "count", "(", "*", ")", "desc", "limit", "value" ]
[ "Return", "the", "publisher", "that", "has", "published", "the", "most", "books", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Show all book categories and the number of books in each category.
SELECT category , count(*) FROM book_club GROUP BY category
[ "SELECT", "category", ",", "count", "(", "*", ")", "FROM", "book_club", "GROUP", "BY", "category" ]
[ "select", "category", ",", "count", "(", "*", ")", "from", "book_club", "group", "by", "category" ]
[ "Show", "all", "book", "categories", "and", "the", "number", "of", "books", "in", "each", "category", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
How many books fall into each category?
SELECT category , count(*) FROM book_club GROUP BY category
[ "SELECT", "category", ",", "count", "(", "*", ")", "FROM", "book_club", "GROUP", "BY", "category" ]
[ "select", "category", ",", "count", "(", "*", ")", "from", "book_club", "group", "by", "category" ]
[ "How", "many", "books", "fall", "into", "each", "category", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
List categories that have at least two books after year 1989.
SELECT category FROM book_club WHERE YEAR > 1989 GROUP BY category HAVING count(*) >= 2
[ "SELECT", "category", "FROM", "book_club", "WHERE", "YEAR", ">", "1989", "GROUP", "BY", "category", "HAVING", "count", "(", "*", ")", ">", "=", "2" ]
[ "select", "category", "from", "book_club", "where", "year", ">", "value", "group", "by", "category", "having", "count", "(", "*", ")", ">", "=", "value" ]
[ "List", "categories", "that", "have", "at", "least", "two", "books", "after", "year", "1989", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
What categories have two or more corresponding books that were made after 1989?
SELECT category FROM book_club WHERE YEAR > 1989 GROUP BY category HAVING count(*) >= 2
[ "SELECT", "category", "FROM", "book_club", "WHERE", "YEAR", ">", "1989", "GROUP", "BY", "category", "HAVING", "count", "(", "*", ")", ">", "=", "2" ]
[ "select", "category", "from", "book_club", "where", "year", ">", "value", "group", "by", "category", "having", "count", "(", "*", ")", ">", "=", "value" ]
[ "What", "categories", "have", "two", "or", "more", "corresponding", "books", "that", "were", "made", "after", "1989", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Show publishers with a book published in 1989 and a book in 1990.
SELECT publisher FROM book_club WHERE YEAR = 1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR = 1990
[ "SELECT", "publisher", "FROM", "book_club", "WHERE", "YEAR", "=", "1989", "INTERSECT", "SELECT", "publisher", "FROM", "book_club", "WHERE", "YEAR", "=", "1990" ]
[ "select", "publisher", "from", "book_club", "where", "year", "=", "value", "intersect", "select", "publisher", "from", "book_club", "where", "year", "=", "value" ]
[ "Show", "publishers", "with", "a", "book", "published", "in", "1989", "and", "a", "book", "in", "1990", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
What are the publishers who have published a book in both 1989 and 1990?
SELECT publisher FROM book_club WHERE YEAR = 1989 INTERSECT SELECT publisher FROM book_club WHERE YEAR = 1990
[ "SELECT", "publisher", "FROM", "book_club", "WHERE", "YEAR", "=", "1989", "INTERSECT", "SELECT", "publisher", "FROM", "book_club", "WHERE", "YEAR", "=", "1990" ]
[ "select", "publisher", "from", "book_club", "where", "year", "=", "value", "intersect", "select", "publisher", "from", "book_club", "where", "year", "=", "value" ]
[ "What", "are", "the", "publishers", "who", "have", "published", "a", "book", "in", "both", "1989", "and", "1990", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Show all publishers which do not have a book in 1989.
SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR = 1989
[ "SELECT", "publisher", "FROM", "book_club", "EXCEPT", "SELECT", "publisher", "FROM", "book_club", "WHERE", "YEAR", "=", "1989" ]
[ "select", "publisher", "from", "book_club", "except", "select", "publisher", "from", "book_club", "where", "year", "=", "value" ]
[ "Show", "all", "publishers", "which", "do", "not", "have", "a", "book", "in", "1989", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Which publishers did not publish a book in 1989?
SELECT publisher FROM book_club EXCEPT SELECT publisher FROM book_club WHERE YEAR = 1989
[ "SELECT", "publisher", "FROM", "book_club", "EXCEPT", "SELECT", "publisher", "FROM", "book_club", "WHERE", "YEAR", "=", "1989" ]
[ "select", "publisher", "from", "book_club", "except", "select", "publisher", "from", "book_club", "where", "year", "=", "value" ]
[ "Which", "publishers", "did", "not", "publish", "a", "book", "in", "1989", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Show all movie titles, years, and directors, ordered by budget.
SELECT title , YEAR , director FROM movie ORDER BY budget_million
[ "SELECT", "title", ",", "YEAR", ",", "director", "FROM", "movie", "ORDER", "BY", "budget_million" ]
[ "select", "title", ",", "year", ",", "director", "from", "movie", "order", "by", "budget_million" ]
[ "Show", "all", "movie", "titles", ",", "years", ",", "and", "directors", ",", "ordered", "by", "budget", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
What are the titles, years, and directors of all movies, ordered by budget in millions?
SELECT title , YEAR , director FROM movie ORDER BY budget_million
[ "SELECT", "title", ",", "YEAR", ",", "director", "FROM", "movie", "ORDER", "BY", "budget_million" ]
[ "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", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
How many movie directors are there?
SELECT COUNT (DISTINCT director) FROM movie
[ "SELECT", "COUNT", "(", "DISTINCT", "director", ")", "FROM", "movie" ]
[ "select", "count", "(", "distinct", "director", ")", "from", "movie" ]
[ "How", "many", "movie", "directors", "are", "there", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Count the number of different directors.
SELECT COUNT (DISTINCT director) FROM movie
[ "SELECT", "COUNT", "(", "DISTINCT", "director", ")", "FROM", "movie" ]
[ "select", "count", "(", "distinct", "director", ")", "from", "movie" ]
[ "Count", "the", "number", "of", "different", "directors", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
What is the title and director for the movie with highest worldwide gross in the year 2000 or before?
SELECT title , director FROM movie WHERE YEAR <= 2000 ORDER BY gross_worldwide DESC LIMIT 1
[ "SELECT", "title", ",", "director", "FROM", "movie", "WHERE", "YEAR", "<", "=", "2000", "ORDER", "BY", "gross_worldwide", "DESC", "LIMIT", "1" ]
[ "select", "title", ",", "director", "from", "movie", "where", "year", "<", "=", "value", "order", "by", "gross_worldwide", "desc", "limit", "value" ]
[ "What", "is", "the", "title", "and", "director", "for", "the", "movie", "with", "highest", "worldwide", "gross", "in", "the", "year", "2000", "or", "before", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Return the title and director of the movie released in the year 2000 or earlier that had the highest worldwide gross.
SELECT title , director FROM movie WHERE YEAR <= 2000 ORDER BY gross_worldwide DESC LIMIT 1
[ "SELECT", "title", ",", "director", "FROM", "movie", "WHERE", "YEAR", "<", "=", "2000", "ORDER", "BY", "gross_worldwide", "DESC", "LIMIT", "1" ]
[ "select", "title", ",", "director", "from", "movie", "where", "year", "<", "=", "value", "order", "by", "gross_worldwide", "desc", "limit", "value" ]
[ "Return", "the", "title", "and", "director", "of", "the", "movie", "released", "in", "the", "year", "2000", "or", "earlier", "that", "had", "the", "highest", "worldwide", "gross", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Show all director names who have a movie in both year 1999 and 2000.
SELECT director FROM movie WHERE YEAR = 2000 INTERSECT SELECT director FROM movie WHERE YEAR = 1999
[ "SELECT", "director", "FROM", "movie", "WHERE", "YEAR", "=", "2000", "INTERSECT", "SELECT", "director", "FROM", "movie", "WHERE", "YEAR", "=", "1999" ]
[ "select", "director", "from", "movie", "where", "year", "=", "value", "intersect", "select", "director", "from", "movie", "where", "year", "=", "value" ]
[ "Show", "all", "director", "names", "who", "have", "a", "movie", "in", "both", "year", "1999", "and", "2000", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Which directors had a movie both in the year 1999 and 2000?
SELECT director FROM movie WHERE YEAR = 2000 INTERSECT SELECT director FROM movie WHERE YEAR = 1999
[ "SELECT", "director", "FROM", "movie", "WHERE", "YEAR", "=", "2000", "INTERSECT", "SELECT", "director", "FROM", "movie", "WHERE", "YEAR", "=", "1999" ]
[ "select", "director", "from", "movie", "where", "year", "=", "value", "intersect", "select", "director", "from", "movie", "where", "year", "=", "value" ]
[ "Which", "directors", "had", "a", "movie", "both", "in", "the", "year", "1999", "and", "2000", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Show all director names who have a movie in the year 1999 or 2000.
SELECT director FROM movie WHERE YEAR = 1999 OR YEAR = 2000
[ "SELECT", "director", "FROM", "movie", "WHERE", "YEAR", "=", "1999", "OR", "YEAR", "=", "2000" ]
[ "select", "director", "from", "movie", "where", "year", "=", "value", "or", "year", "=", "value" ]
[ "Show", "all", "director", "names", "who", "have", "a", "movie", "in", "the", "year", "1999", "or", "2000", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Which directors had a movie in either 1999 or 2000?
SELECT director FROM movie WHERE YEAR = 1999 OR YEAR = 2000
[ "SELECT", "director", "FROM", "movie", "WHERE", "YEAR", "=", "1999", "OR", "YEAR", "=", "2000" ]
[ "select", "director", "from", "movie", "where", "year", "=", "value", "or", "year", "=", "value" ]
[ "Which", "directors", "had", "a", "movie", "in", "either", "1999", "or", "2000", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
What is the average, maximum, and minimum budget for all movies before 2000.
SELECT avg(budget_million) , max(budget_million) , min(budget_million) FROM movie WHERE YEAR < 2000
[ "SELECT", "avg", "(", "budget_million", ")", ",", "max", "(", "budget_million", ")", ",", "min", "(", "budget_million", ")", "FROM", "movie", "WHERE", "YEAR", "<", "2000" ]
[ "select", "avg", "(", "budget_million", ")", ",", "max", "(", "budget_million", ")", ",", "min", "(", "budget_million", ")", "from", "movie", "where", "year", "<", "value" ]
[ "What", "is", "the", "average", ",", "maximum", ",", "and", "minimum", "budget", "for", "all", "movies", "before", "2000", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Return the average, maximum, and minimum budgets in millions for movies made before the year 2000.
SELECT avg(budget_million) , max(budget_million) , min(budget_million) FROM movie WHERE YEAR < 2000
[ "SELECT", "avg", "(", "budget_million", ")", ",", "max", "(", "budget_million", ")", ",", "min", "(", "budget_million", ")", "FROM", "movie", "WHERE", "YEAR", "<", "2000" ]
[ "select", "avg", "(", "budget_million", ")", ",", "max", "(", "budget_million", ")", ",", "min", "(", "budget_million", ")", "from", "movie", "where", "year", "<", "value" ]
[ "Return", "the", "average", ",", "maximum", ",", "and", "minimum", "budgets", "in", "millions", "for", "movies", "made", "before", "the", "year", "2000", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
List all company names with a book published by Alyson.
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'
[ "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", "'" ]
[ "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", "=", "value" ]
[ "List", "all", "company", "names", "with", "a", "book", "published", "by", "Alyson", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
What are all the company names that have a book published by Alyson?
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'
[ "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", "'" ]
[ "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", "=", "value" ]
[ "What", "are", "all", "the", "company", "names", "that", "have", "a", "book", "published", "by", "Alyson", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Show the movie titles and book titles for all companies in China.
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'
[ "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", "'" ]
[ "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", "=", "value" ]
[ "Show", "the", "movie", "titles", "and", "book", "titles", "for", "all", "companies", "in", "China", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
What are the titles of movies and books corresponding to companies incorporated in China?
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'
[ "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", "'" ]
[ "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", "=", "value" ]
[ "What", "are", "the", "titles", "of", "movies", "and", "books", "corresponding", "to", "companies", "incorporated", "in", "China", "?" ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
Show all company names with a movie directed in year 1999.
SELECT T2.company_name FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id WHERE T1.year = 1999
[ "SELECT", "T2.company_name", "FROM", "movie", "AS", "T1", "JOIN", "culture_company", "AS", "T2", "ON", "T1.movie_id", "=", "T2.movie_id", "WHERE", "T1.year", "=", "1999" ]
[ "select", "t2", ".", "company_name", "from", "movie", "as", "t1", "join", "culture_company", "as", "t2", "on", "t1", ".", "movie_id", "=", "t2", ".", "movie_id", "where", "t1", ".", "year", "=", "value" ]
[ "Show", "all", "company", "names", "with", "a", "movie", "directed", "in", "year", "1999", "." ]
culture_company
[ "CREATE TABLE \"book_club\" (\n\"book_club_id\" int,\n\"Year\" int,\n\"Author_or_Editor\" text,\n\"Book_Title\" text,\n\"Publisher\" text,\n\"Category\" text,\n\"Result\" text,\nPRIMARY KEY (\"book_club_id\")\n);", "CREATE TABLE \"movie\" (\n\"movie_id\" int,\n\"Title\" text,\n\"Year\" int,\n\"Director\" text,\n\"Budget_million\" real,\n\"Gross_worldwide\" int,\nPRIMARY KEY(\"movie_id\")\n);", "CREATE TABLE \"culture_company\" (\n\"Company_name\" text,\n\"Type\" text,\n\"Incorporated_in\" text,\n\"Group_Equity_Shareholding\" real,\n\"book_club_id\" text,\n\"movie_id\" text,\nPRIMARY KEY(\"Company_name\"),\nFOREIGN KEY (\"book_club_id\") REFERENCES \"book_club\"(\"book_club_id\"),\nFOREIGN KEY (\"movie_id\") REFERENCES \"movie\"(\"movie_id\")\n);" ]
What are all company names that have a corresponding movie directed in the year 1999?
SELECT T2.company_name FROM movie AS T1 JOIN culture_company AS T2 ON T1.movie_id = T2.movie_id WHERE T1.year = 1999
[ "SELECT", "T2.company_name", "FROM", "movie", "AS", "T1", "JOIN", "culture_company", "AS", "T2", "ON", "T1.movie_id", "=", "T2.movie_id", "WHERE", "T1.year", "=", "1999" ]
[ "select", "t2", ".", "company_name", "from", "movie", "as", "t1", "join", "culture_company", "as", "t2", "on", "t1", ".", "movie_id", "=", "t2", ".", "movie_id", "where", "t1", ".", "year", "=", "value" ]
[ "What", "are", "all", "company", "names", "that", "have", "a", "corresponding", "movie", "directed", "in", "the", "year", "1999", "?" ]