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