messages
listlengths
3
3
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Find the id of the customer who made the most orders.\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_id from customers join orders on customers.customer_id = orders.customer_id group by customers.customer_id order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Give me a list of id and status of orders which belong to the customer named \"Jeramie\".\nSELECT \n" }, { "role": "assistant", "content": "orders.order_id , orders.order_status from customers join orders on customers.customer_id = orders.customer_id where customers.customer_name = 'Jeramie'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Which orders are made by the customer named \"Jeramie\"? Give me the order ids and status.\nSELECT \n" }, { "role": "assistant", "content": "orders.order_id , orders.order_status from customers join orders on customers.customer_id = orders.customer_id where customers.customer_name = 'Jeramie'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Find the dates of orders which belong to the customer named \"Jeramie\".\nSELECT \n" }, { "role": "assistant", "content": "orders.date_order_placed from customers join orders on customers.customer_id = orders.customer_id where customers.customer_name = 'Jeramie'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### What are the dates of the orders made by the customer named \"Jeramie\"?\nSELECT \n" }, { "role": "assistant", "content": "orders.date_order_placed from customers join orders on customers.customer_id = orders.customer_id where customers.customer_name = 'Jeramie'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Give me the names of customers who have placed orders between 2009-01-01 and 2010-01-01.\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name from customers join orders on customers.customer_id = orders.customer_id where orders.date_order_placed >= '2009-01-01' and orders.date_order_placed <= '2010-01-01'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Which customers made orders between 2009-01-01 and 2010-01-01? Find their names.\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name from customers join orders on customers.customer_id = orders.customer_id where orders.date_order_placed >= '2009-01-01' and orders.date_order_placed <= '2010-01-01'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Give me a list of distinct product ids from orders placed between 1975-01-01 and 1976-01-01?\nSELECT \n" }, { "role": "assistant", "content": "distinct order_items.product_id from orders join order_items on orders.order_id = order_items.order_id where orders.date_order_placed >= '1975-01-01' and orders.date_order_placed <= '1976-01-01'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### What are the distinct ids of products ordered between 1975-01-01 and 1976-01-01??\nSELECT \n" }, { "role": "assistant", "content": "distinct order_items.product_id from orders join order_items on orders.order_id = order_items.order_id where orders.date_order_placed >= '1975-01-01' and orders.date_order_placed <= '1976-01-01'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Find the names of the customers who have order status both \"On Road\" and \"Shipped\".\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name from customers join orders on customers.customer_id = orders.customer_id where orders.order_status = 'On Road' intersect select customers.customer_name from customers join orders on customers.customer_id = orders.customer_id where orders.order_status = 'Shipped'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Which customers have both \"On Road\" and \"Shipped\" as order status? List the customer names.\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name from customers join orders on customers.customer_id = orders.customer_id where orders.order_status = 'On Road' intersect select customers.customer_name from customers join orders on customers.customer_id = orders.customer_id where orders.order_status = 'Shipped'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Find the id of the customers who have order status both \"On Road\" and \"Shipped\".\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_id from customers join orders on customers.customer_id = orders.customer_id where orders.order_status = 'On Road' intersect select customers.customer_id from customers join orders on customers.customer_id = orders.customer_id where orders.order_status = 'Shipped'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Which customers have both \"On Road\" and \"Shipped\" as order status? List the customer ids.\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_id from customers join orders on customers.customer_id = orders.customer_id where orders.order_status = 'On Road' intersect select customers.customer_id from customers join orders on customers.customer_id = orders.customer_id where orders.order_status = 'Shipped'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### When was the order placed whose shipment tracking number is 3452? Give me the date.\nSELECT \n" }, { "role": "assistant", "content": "orders.date_order_placed from orders join shipments on orders.order_id = shipments.order_id where shipments.shipment_tracking_number = 3452" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### On which day was the order placed whose shipment tracking number is 3452?\nSELECT \n" }, { "role": "assistant", "content": "orders.date_order_placed from orders join shipments on orders.order_id = shipments.order_id where shipments.shipment_tracking_number = 3452" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### What is the placement date of the order whose invoice number is 10?\nSELECT \n" }, { "role": "assistant", "content": "orders.date_order_placed from orders join shipments on orders.order_id = shipments.order_id where shipments.invoice_number = 10" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### On what day was the order with invoice number 10 placed?\nSELECT \n" }, { "role": "assistant", "content": "orders.date_order_placed from orders join shipments on orders.order_id = shipments.order_id where shipments.invoice_number = 10" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### List the count and id of each product in all the orders.\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) , products.product_id from orders join order_items join products on orders.order_id = order_items.order_id and order_items.product_id = products.product_id group by products.product_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### For each product, return its id and the number of times it was ordered.\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) , products.product_id from orders join order_items join products on orders.order_id = order_items.order_id and order_items.product_id = products.product_id group by products.product_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### List the name and count of each product in all orders.\nSELECT \n" }, { "role": "assistant", "content": "products.product_name , count ( * ) from orders join order_items join products on orders.order_id = order_items.order_id and order_items.product_id = products.product_id group by products.product_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### For each product, show its name and the number of times it was ordered.\nSELECT \n" }, { "role": "assistant", "content": "products.product_name , count ( * ) from orders join order_items join products on orders.order_id = order_items.order_id and order_items.product_id = products.product_id group by products.product_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Find the ids of orders which are shipped after 2000-01-01.\nSELECT \n" }, { "role": "assistant", "content": "order_id from shipments where shipment_date > '2000-01-01'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Which orders have shipment after 2000-01-01? Give me the order ids.\nSELECT \n" }, { "role": "assistant", "content": "order_id from shipments where shipment_date > '2000-01-01'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Find the id of the order which is shipped most recently.\nSELECT \n" }, { "role": "assistant", "content": "order_id from shipments where shipment_date = ( select max ( shipment_date ) from shipments )" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Which order has the most recent shipment? Give me the order id.\nSELECT \n" }, { "role": "assistant", "content": "order_id from shipments where shipment_date = ( select max ( shipment_date ) from shipments )" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### List the names of all distinct products in alphabetical order.\nSELECT \n" }, { "role": "assistant", "content": "distinct product_name from products order by product_name asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Sort all the distinct products in alphabetical order.\nSELECT \n" }, { "role": "assistant", "content": "distinct product_name from products order by product_name asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### List the ids of all distinct orders ordered by placed date.\nSELECT \n" }, { "role": "assistant", "content": "distinct order_id from orders order by date_order_placed asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### What are ids of the all distinct orders, sorted by placement date?\nSELECT \n" }, { "role": "assistant", "content": "distinct order_id from orders order by date_order_placed asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### What is the id of the order which has the most items?\nSELECT \n" }, { "role": "assistant", "content": "orders.order_id from orders join order_items on orders.order_id = order_items.order_id group by orders.order_id order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Which order deals with the most items? Return the order id.\nSELECT \n" }, { "role": "assistant", "content": "orders.order_id from orders join order_items on orders.order_id = order_items.order_id group by orders.order_id order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### What is the name of the customer who has the largest number of orders?\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name from customers join orders on customers.customer_id = orders.customer_id group by customers.customer_id order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Find the name of the customer who made the most orders.\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name from customers join orders on customers.customer_id = orders.customer_id group by customers.customer_id order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Find the invoice numbers which are created before 1989-09-03 or after 2007-12-25.\nSELECT \n" }, { "role": "assistant", "content": "invoice_number from invoices where invoice_date < '1989-09-03' or invoice_date > '2007-12-25'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### What are the invoice numbers created before 1989-09-03 or after 2007-12-25?\nSELECT \n" }, { "role": "assistant", "content": "invoice_number from invoices where invoice_date < '1989-09-03' or invoice_date > '2007-12-25'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Find the distinct details of invoices which are created before 1989-09-03 or after 2007-12-25.\nSELECT \n" }, { "role": "assistant", "content": "distinct invoice_details from invoices where invoice_date < '1989-09-03' or invoice_date > '2007-12-25'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### What are the distinct details of invoices created before 1989-09-03 or after 2007-12-25?\nSELECT \n" }, { "role": "assistant", "content": "distinct invoice_details from invoices where invoice_date < '1989-09-03' or invoice_date > '2007-12-25'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### For each customer who has at least two orders, find the customer name and number of orders made.\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name , count ( * ) from orders join customers on orders.customer_id = customers.customer_id group by customers.customer_id having count ( * ) >= 2" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Which customers have made at least two orders? Give me each customer name and number of orders made.\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name , count ( * ) from orders join customers on orders.customer_id = customers.customer_id group by customers.customer_id having count ( * ) >= 2" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Find the name of the customers who have at most two orders.\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name from orders join customers on orders.customer_id = customers.customer_id group by customers.customer_id having count ( * ) <= 2" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### What are the names of the customers who have made two or less orders?\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name from orders join customers on orders.customer_id = customers.customer_id group by customers.customer_id having count ( * ) <= 2" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### List the names of the customers who have once bought product \"food\".\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name from customers join orders join order_items join products on customers.customer_id = orders.customer_id and orders.order_id = order_items.order_id and order_items.product_id = products.product_id where products.product_name = 'food' group by customers.customer_id having count ( * ) >= 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### What are the names of the customers who bought product \"food\" at least once?\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name from customers join orders join order_items join products on customers.customer_id = orders.customer_id and orders.order_id = order_items.order_id and order_items.product_id = products.product_id where products.product_name = 'food' group by customers.customer_id having count ( * ) >= 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### List the names of customers who have once canceled the purchase of the product \"food\" (the item status is \"Cancel\").\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name from customers join orders join order_items join products on customers.customer_id = orders.customer_id and orders.order_id = order_items.order_id and order_items.product_id = products.product_id where order_items.order_item_status = 'Cancel' and products.product_name = 'food' group by customers.customer_id having count ( * ) >= 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# customers ( customer_id , customer_name , customer_details )\n# invoices ( invoice_number , invoice_date , invoice_details )\n# orders ( order_id , customer_id , order_status , date_order_placed , order_details )\n# products ( product_id , product_name , product_details )\n# order_items ( order_item_id , product_id , order_id , order_item_status , order_item_details )\n# shipments ( shipment_id , order_id , invoice_number , shipment_tracking_number , shipment_date , other_shipment_details )\n# shipment_items ( shipment_id , order_item_id )\n# orders.customer_id = customers.customer_id\n# order_items.product_id = products.product_id\n# order_items.order_id = orders.order_id\n# shipments.invoice_number = invoices.invoice_number\n# shipments.order_id = orders.order_id\n# shipment_items.shipment_id = shipments.shipment_id\n# shipment_items.order_item_id = order_items.order_item_id\n\n#\n### Which customers have ever canceled the purchase of the product \"food\" (the item status is \"Cancel\")?\nSELECT \n" }, { "role": "assistant", "content": "customers.customer_name from customers join orders join order_items join products on customers.customer_id = orders.customer_id and orders.order_id = order_items.order_id and order_items.product_id = products.product_id where order_items.order_item_status = 'Cancel' and products.product_name = 'food' group by customers.customer_id having count ( * ) >= 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### How many architects are female?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from architect where gender = 'female'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### List the name, nationality and id of all male architects ordered by their names lexicographically.\nSELECT \n" }, { "role": "assistant", "content": "name , nationality , id from architect where gender = 'male' order by name asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### What is the maximum length in meters for the bridges and what are the architects' names?\nSELECT \n" }, { "role": "assistant", "content": "max ( bridge.length_meters ) , architect.name from bridge join architect on bridge.architect_id = architect.id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### What is the average length in feet of the bridges?\nSELECT \n" }, { "role": "assistant", "content": "avg ( length_feet ) from bridge" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### What are the names and year of construction for the mills of 'Grondzeiler' type?\nSELECT \n" }, { "role": "assistant", "content": "name , built_year from mill where type = 'Grondzeiler'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### What are the distinct names and nationalities of the architects who have ever built a mill?\nSELECT \n" }, { "role": "assistant", "content": "distinct architect.name , architect.nationality from architect join mill on architect.id = mill.architect_id" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### What are the names of the mills which are not located in 'Donceel'?\nSELECT \n" }, { "role": "assistant", "content": "name from mill where location != 'Donceel'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### What are the distinct types of mills that are built by American or Canadian architects?\nSELECT \n" }, { "role": "assistant", "content": "distinct mill.type from mill join architect on mill.architect_id = architect.id where architect.nationality = 'American' or architect.nationality = 'Canadian'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### What are the ids and names of the architects who built at least 3 bridges ?\nSELECT \n" }, { "role": "assistant", "content": "architect.id , architect.name from architect join bridge on architect.id = bridge.architect_id group by architect.id having count ( * ) >= 3" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### What is the id, name and nationality of the architect who built most mills?\nSELECT \n" }, { "role": "assistant", "content": "architect.id , architect.name , architect.nationality from architect join mill on architect.id = mill.architect_id group by architect.id order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### What are the ids, names and genders of the architects who built two bridges or one mill?\nSELECT \n" }, { "role": "assistant", "content": "architect.id , architect.name , architect.gender from architect join bridge on architect.id = mill.architect_id group by architect.id having count ( * ) = 2 union select architect.id , architect.name , architect.gender from architect join mill on architect.id = mill.architect_id group by architect.id having count ( * ) = 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### What is the location of the bridge named 'Kolob Arch' or 'Rainbow Bridge'?\nSELECT \n" }, { "role": "assistant", "content": "location from bridge where name = 'Kolob Arch' or name = 'Rainbow Bridge'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### Which of the mill names contains the french word 'Moulin'?\nSELECT \n" }, { "role": "assistant", "content": "name from mill where name like '%Moulin%'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### What are the distinct name of the mills built by the architects who have also built a bridge longer than 80 meters?\nSELECT \n" }, { "role": "assistant", "content": "distinct mill.name from mill join architect on mill.architect_id = architect.id join bridge on bridge.architect_id = architect.id where bridge.length_meters > 80" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### What is the most common mill type, and how many are there?\nSELECT \n" }, { "role": "assistant", "content": "type , count ( * ) from mill group by type order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### How many architects haven't built a mill before year 1850?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from architect where id not in ( select architect_id from mill where built_year < 1850 )" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# architect ( id , name , nationality , gender )\n# bridge ( architect_id , id , name , location , length_meters , length_feet )\n# mill ( architect_id , id , location , name , type , built_year , notes )\n# bridge.architect_id = architect.id\n# mill.architect_id = architect.id\n\n#\n### show the name of all bridges that was designed by american archtect, and sort the result by the bridge feet length.\nSELECT \n" }, { "role": "assistant", "content": "bridge.name from bridge join architect on bridge.architect_id = architect.id where architect.nationality = 'American' order by bridge.length_feet asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### How many book clubs are there?\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from book_club" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Count the number of book clubs.\nSELECT \n" }, { "role": "assistant", "content": "count ( * ) from book_club" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### show the titles, and authors or editors for all books made after the year 1989.\nSELECT \n" }, { "role": "assistant", "content": "book_title , author_or_editor from book_club where year > 1989" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### What are the titles and authors or editors that correspond to books made after 1989?\nSELECT \n" }, { "role": "assistant", "content": "book_title , author_or_editor from book_club where year > 1989" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Show all distinct publishers for books.\nSELECT \n" }, { "role": "assistant", "content": "distinct publisher from book_club" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### What are all the different book publishers?\nSELECT \n" }, { "role": "assistant", "content": "distinct publisher from book_club" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Show the years, book titles, and publishers for all books, in descending order by year.\nSELECT \n" }, { "role": "assistant", "content": "year , book_title , publisher from book_club order by year desc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### What are the years, titles, and publishers for all books, ordered by year descending?\nSELECT \n" }, { "role": "assistant", "content": "year , book_title , publisher from book_club order by year desc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Show all publishers and the number of books for each publisher.\nSELECT \n" }, { "role": "assistant", "content": "publisher , count ( * ) from book_club group by publisher" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### How many books are there for each publisher?\nSELECT \n" }, { "role": "assistant", "content": "publisher , count ( * ) from book_club group by publisher" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### What is the publisher with most number of books?\nSELECT \n" }, { "role": "assistant", "content": "publisher from book_club group by publisher order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Return the publisher that has published the most books.\nSELECT \n" }, { "role": "assistant", "content": "publisher from book_club group by publisher order by count ( * ) desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Show all book categories and the number of books in each category.\nSELECT \n" }, { "role": "assistant", "content": "category , count ( * ) from book_club group by category" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### How many books fall into each category?\nSELECT \n" }, { "role": "assistant", "content": "category , count ( * ) from book_club group by category" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### List categories that have at least two books after year 1989.\nSELECT \n" }, { "role": "assistant", "content": "category from book_club where year > 1989 group by category having count ( * ) >= 2" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### What categories have two or more corresponding books that were made after 1989?\nSELECT \n" }, { "role": "assistant", "content": "category from book_club where year > 1989 group by category having count ( * ) >= 2" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Show publishers with a book published in 1989 and a book in 1990.\nSELECT \n" }, { "role": "assistant", "content": "publisher from book_club where year = 1989 intersect select publisher from book_club where year = 1990" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### What are the publishers who have published a book in both 1989 and 1990?\nSELECT \n" }, { "role": "assistant", "content": "publisher from book_club where year = 1989 intersect select publisher from book_club where year = 1990" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Show all publishers which do not have a book in 1989.\nSELECT \n" }, { "role": "assistant", "content": "publisher from book_club except select publisher from book_club where year = 1989" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Which publishers did not publish a book in 1989?\nSELECT \n" }, { "role": "assistant", "content": "publisher from book_club except select publisher from book_club where year = 1989" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Show all movie titles, years, and directors, ordered by budget.\nSELECT \n" }, { "role": "assistant", "content": "title , year , director from movie order by budget_million asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### What are the titles, years, and directors of all movies, ordered by budget in millions?\nSELECT \n" }, { "role": "assistant", "content": "title , year , director from movie order by budget_million asc" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### How many movie directors are there?\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct director ) from movie" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Count the number of different directors.\nSELECT \n" }, { "role": "assistant", "content": "count ( distinct director ) from movie" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### What is the title and director for the movie with highest worldwide gross in the year 2000 or before?\nSELECT \n" }, { "role": "assistant", "content": "title , director from movie where year <= 2000 order by gross_worldwide desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Return the title and director of the movie released in the year 2000 or earlier that had the highest worldwide gross.\nSELECT \n" }, { "role": "assistant", "content": "title , director from movie where year <= 2000 order by gross_worldwide desc limit 1" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Show all director names who have a movie in both year 1999 and 2000.\nSELECT \n" }, { "role": "assistant", "content": "director from movie where year = 2000 intersect select director from movie where year = 1999" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Which directors had a movie both in the year 1999 and 2000?\nSELECT \n" }, { "role": "assistant", "content": "director from movie where year = 2000 intersect select director from movie where year = 1999" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Show all director names who have a movie in the year 1999 or 2000.\nSELECT \n" }, { "role": "assistant", "content": "director from movie where year = 1999 or year = 2000" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Which directors had a movie in either 1999 or 2000?\nSELECT \n" }, { "role": "assistant", "content": "director from movie where year = 1999 or year = 2000" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### What is the average, maximum, and minimum budget for all movies before 2000.\nSELECT \n" }, { "role": "assistant", "content": "avg ( budget_million ) , max ( budget_million ) , min ( budget_million ) from movie where year < 2000" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Return the average, maximum, and minimum budgets in millions for movies made before the year 2000.\nSELECT \n" }, { "role": "assistant", "content": "avg ( budget_million ) , max ( budget_million ) , min ( budget_million ) from movie where year < 2000" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### List all company names with a book published by Alyson.\nSELECT \n" }, { "role": "assistant", "content": "culture_company.company_name from culture_company join book_club on culture_company.book_club_id = book_club.book_club_id where book_club.publisher = 'Alyson'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### What are all the company names that have a book published by Alyson?\nSELECT \n" }, { "role": "assistant", "content": "culture_company.company_name from culture_company join book_club on culture_company.book_club_id = book_club.book_club_id where book_club.publisher = 'Alyson'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Show the movie titles and book titles for all companies in China.\nSELECT \n" }, { "role": "assistant", "content": "movie.title , book_club.book_title from movie join culture_company on movie.movie_id = culture_company.movie_id join book_club on book_club.book_club_id = culture_company.book_club_id where culture_company.incorporated_in = 'China'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### What are the titles of movies and books corresponding to companies incorporated in China?\nSELECT \n" }, { "role": "assistant", "content": "movie.title , book_club.book_title from movie join culture_company on movie.movie_id = culture_company.movie_id join book_club on book_club.book_club_id = culture_company.book_club_id where culture_company.incorporated_in = 'China'" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### Show all company names with a movie directed in year 1999.\nSELECT \n" }, { "role": "assistant", "content": "culture_company.company_name from movie join culture_company on movie.movie_id = culture_company.movie_id where movie.year = 1999" } ]
[ { "role": "system", "content": "You are an excellent SQL writer." }, { "role": "user", "content": "### Complete sqlite SQL query only and with no explanation, and do not select extra columns that are not explicitly requested in the query.\n### Sqlite SQL tables, with their properties:\n#\n# book_club ( book_club_id , year , author_or_editor , book_title , publisher , category , result )\n# movie ( movie_id , title , year , director , budget_million , gross_worldwide )\n# culture_company ( company_name , type , incorporated_in , group_equity_shareholding , book_club_id , movie_id )\n# culture_company.movie_id = movie.movie_id\n# culture_company.book_club_id = book_club.book_club_id\n\n#\n### What are all company names that have a corresponding movie directed in the year 1999?\nSELECT \n" }, { "role": "assistant", "content": "culture_company.company_name from movie join culture_company on movie.movie_id = culture_company.movie_id where movie.year = 1999" } ]