db_id
stringlengths
4
31
SQL
stringlengths
18
1.45k
input_sequence
stringlengths
148
11k
question
stringlengths
16
325
tracking_orders
select t1.customer_id from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id group by t1.customer_id order by count(*) desc limit 1
Question: find the id of the customer who made the most orders. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, product_d...
find the id of the customer who made the most orders.
tracking_orders
select t2.order_id , t2.order_status from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t1.customer_name = 'jeramie'
Question: give me a list of id and status of orders which belong to the customer named 'jeramie'. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> p...
give me a list of id and status of orders which belong to the customer named 'jeramie'.
tracking_orders
select t2.order_id , t2.order_status from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t1.customer_name = 'jeramie'
Question: which orders are made by the customer named 'jeramie'? give me the order ids and status. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> ...
which orders are made by the customer named 'jeramie'? give me the order ids and status.
tracking_orders
select t2.date_order_placed from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t1.customer_name = 'jeramie'
Question: find the dates of orders which belong to the customer named 'jeramie'. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, produc...
find the dates of orders which belong to the customer named 'jeramie'.
tracking_orders
select t2.date_order_placed from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t1.customer_name = 'jeramie'
Question: what are the dates of the orders made by the customer named 'jeramie'? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, produc...
what are the dates of the orders made by the customer named 'jeramie'?
tracking_orders
select t1.customer_name from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.date_order_placed >= '2009-01-01' and t2.date_order_placed <= '2010-01-01'
Question: give me the names of customers who have placed orders between 2009-01-01 and 2010-01-01. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> ...
give me the names of customers who have placed orders between 2009-01-01 and 2010-01-01.
tracking_orders
select t1.customer_name from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.date_order_placed >= '2009-01-01' and t2.date_order_placed <= '2010-01-01'
Question: which customers made orders between 2009-01-01 and 2010-01-01? find their names. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_...
which customers made orders between 2009-01-01 and 2010-01-01? find their names.
tracking_orders
select distinct t2.product_id from orders as t1 join order_items as t2 on t1.order_id = t2.order_id where t1.date_order_placed >= '1975-01-01' and t1.date_order_placed <= '1976-01-01'
Question: give me a list of distinct product ids from orders placed between 1975-01-01 and 1976-01-01? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products...
give me a list of distinct product ids from orders placed between 1975-01-01 and 1976-01-01?
tracking_orders
select distinct t2.product_id from orders as t1 join order_items as t2 on t1.order_id = t2.order_id where t1.date_order_placed >= '1975-01-01' and t1.date_order_placed <= '1976-01-01'
Question: what are the distinct ids of products ordered between 1975-01-01 and 1976-01-01?? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product...
what are the distinct ids of products ordered between 1975-01-01 and 1976-01-01??
tracking_orders
select t1.customer_name from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.order_status = 'on road' intersect select t1.customer_name from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.order_status = 'shipped'
Question: find the names of the customers who have order status both 'on road' and 'shipped'. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> produ...
find the names of the customers who have order status both 'on road' and 'shipped'.
tracking_orders
select t1.customer_name from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.order_status = 'on road' intersect select t1.customer_name from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.order_status = 'shipped'
Question: which customers have both 'on road' and 'shipped' as order status? list the customer names. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products ...
which customers have both 'on road' and 'shipped' as order status? list the customer names.
tracking_orders
select t1.customer_id from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.order_status = 'on road' intersect select t1.customer_id from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.order_status = 'shipped'
Question: find the id of the customers who have order status both 'on road' and 'shipped'. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_...
find the id of the customers who have order status both 'on road' and 'shipped'.
tracking_orders
select t1.customer_id from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.order_status = 'on road' intersect select t1.customer_id from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id where t2.order_status = 'shipped'
Question: which customers have both 'on road' and 'shipped' as order status? list the customer ids. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products ->...
which customers have both 'on road' and 'shipped' as order status? list the customer ids.
tracking_orders
select t1.date_order_placed from orders as t1 join shipments as t2 on t1.order_id = t2.order_id where t2.shipment_tracking_number = 3452
Question: when was the order placed whose shipment tracking number is 3452? give me the date. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> produ...
when was the order placed whose shipment tracking number is 3452? give me the date.
tracking_orders
select t1.date_order_placed from orders as t1 join shipments as t2 on t1.order_id = t2.order_id where t2.shipment_tracking_number = 3452
Question: on which day was the order placed whose shipment tracking number is 3452? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, pro...
on which day was the order placed whose shipment tracking number is 3452?
tracking_orders
select t1.date_order_placed from orders as t1 join shipments as t2 on t1.order_id = t2.order_id where t2.invoice_number = 10
Question: what is the placement date of the order whose invoice number is 10? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_n...
what is the placement date of the order whose invoice number is 10?
tracking_orders
select t1.date_order_placed from orders as t1 join shipments as t2 on t1.order_id = t2.order_id where t2.invoice_number = 10
Question: on what day was the order with invoice number 10 placed? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, produc...
on what day was the order with invoice number 10 placed?
tracking_orders
select count(*) , t3.product_id from orders as t1 join order_items as t2 join products as t3 on t1.order_id = t2.order_id and t2.product_id = t3.product_id group by t3.product_id
Question: list the count and id of each product in all the orders. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, produc...
list the count and id of each product in all the orders.
tracking_orders
select count(*) , t3.product_id from orders as t1 join order_items as t2 join products as t3 on t1.order_id = t2.order_id and t2.product_id = t3.product_id group by t3.product_id
Question: for each product, return its id and the number of times it was ordered. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, produ...
for each product, return its id and the number of times it was ordered.
tracking_orders
select t3.product_name , count(*) from orders as t1 join order_items as t2 join products as t3 on t1.order_id = t2.order_id and t2.product_id = t3.product_id group by t3.product_id
Question: list the name and count of each product in all orders. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, product_...
list the name and count of each product in all orders.
tracking_orders
select t3.product_name , count(*) from orders as t1 join order_items as t2 join products as t3 on t1.order_id = t2.order_id and t2.product_id = t3.product_id group by t3.product_id
Question: for each product, show its name and the number of times it was ordered. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, produ...
for each product, show its name and the number of times it was ordered.
tracking_orders
select order_id from shipments where shipment_date > '2000-01-01'
Question: find the ids of orders which are shipped after 2000-01-01. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, prod...
find the ids of orders which are shipped after 2000-01-01.
tracking_orders
select order_id from shipments where shipment_date > '2000-01-01'
Question: which orders have shipment after 2000-01-01? give me the order ids. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_n...
which orders have shipment after 2000-01-01? give me the order ids.
tracking_orders
select order_id from shipments where shipment_date = (select max(shipment_date) from shipments)
Question: find the id of the order which is shipped most recently. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, produc...
find the id of the order which is shipped most recently.
tracking_orders
select order_id from shipments where shipment_date = (select max(shipment_date) from shipments)
Question: which order has the most recent shipment? give me the order id. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name,...
which order has the most recent shipment? give me the order id.
tracking_orders
select distinct product_name from products order by product_name
Question: list the names of all distinct products in alphabetical order. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, ...
list the names of all distinct products in alphabetical order.
tracking_orders
select distinct product_name from products order by product_name
Question: sort all the distinct products in alphabetical order. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, product_d...
sort all the distinct products in alphabetical order.
tracking_orders
select distinct order_id from orders order by date_order_placed
Question: list the ids of all distinct orders ordered by placed date. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, pro...
list the ids of all distinct orders ordered by placed date.
tracking_orders
select distinct order_id from orders order by date_order_placed
Question: what are ids of the all distinct orders, sorted by placement date? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_na...
what are ids of the all distinct orders, sorted by placement date?
tracking_orders
select t1.order_id from orders as t1 join order_items as t2 on t1.order_id = t2.order_id group by t1.order_id order by count(*) desc limit 1
Question: what is the id of the order which has the most items? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, product_d...
what is the id of the order which has the most items?
tracking_orders
select t1.order_id from orders as t1 join order_items as t2 on t1.order_id = t2.order_id group by t1.order_id order by count(*) desc limit 1
Question: which order deals with the most items? return the order id. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, pro...
which order deals with the most items? return the order id.
tracking_orders
select t1.customer_name from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id group by t1.customer_id order by count(*) desc limit 1
Question: what is the name of the customer who has the largest number of orders? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, produc...
what is the name of the customer who has the largest number of orders?
tracking_orders
select t1.customer_name from customers as t1 join orders as t2 on t1.customer_id = t2.customer_id group by t1.customer_id order by count(*) desc limit 1
Question: find the name of the customer who made the most orders. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, product...
find the name of the customer who made the most orders.
tracking_orders
select invoice_number from invoices where invoice_date < '1989-09-03' or invoice_date > '2007-12-25'
Question: find the invoice numbers which are created before 1989-09-03 or after 2007-12-25. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product...
find the invoice numbers which are created before 1989-09-03 or after 2007-12-25.
tracking_orders
select invoice_number from invoices where invoice_date < '1989-09-03' or invoice_date > '2007-12-25'
Question: what are the invoice numbers created before 1989-09-03 or after 2007-12-25? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, p...
what are the invoice numbers created before 1989-09-03 or after 2007-12-25?
tracking_orders
select distinct invoice_details from invoices where invoice_date < '1989-09-03' or invoice_date > '2007-12-25'
Question: find the distinct details of invoices which are created before 1989-09-03 or after 2007-12-25. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Produc...
find the distinct details of invoices which are created before 1989-09-03 or after 2007-12-25.
tracking_orders
select distinct invoice_details from invoices where invoice_date < '1989-09-03' or invoice_date > '2007-12-25'
Question: what are the distinct details of invoices created before 1989-09-03 or after 2007-12-25? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> ...
what are the distinct details of invoices created before 1989-09-03 or after 2007-12-25?
tracking_orders
select t2.customer_name , count(*) from orders as t1 join customers as t2 on t1.customer_id = t2.customer_id group by t2.customer_id having count(*) >= 2
Question: for each customer who has at least two orders, find the customer name and number of orders made. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Prod...
for each customer who has at least two orders, find the customer name and number of orders made.
tracking_orders
select t2.customer_name , count(*) from orders as t1 join customers as t2 on t1.customer_id = t2.customer_id group by t2.customer_id having count(*) >= 2
Question: which customers have made at least two orders? give me each customer name and number of orders made. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. ...
which customers have made at least two orders? give me each customer name and number of orders made.
tracking_orders
select t2.customer_name from orders as t1 join customers as t2 on t1.customer_id = t2.customer_id group by t2.customer_id having count(*) <= 2
Question: find the name of the customers who have at most two orders. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_name, pro...
find the name of the customers who have at most two orders.
tracking_orders
select t2.customer_name from orders as t1 join customers as t2 on t1.customer_id = t2.customer_id group by t2.customer_id having count(*) <= 2
Question: what are the names of the customers who have made two or less orders? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product...
what are the names of the customers who have made two or less orders?
tracking_orders
select t1.customer_name from customers as t1 join orders as t2 join order_items as t3 join products as t4 on t1.customer_id = t2.customer_id and t2.order_id = t3.order_id and t3.product_id = t4.product_id where t4.product_name = 'food' group by t1.customer_id having count(*) >= 1
Question: list the names of the customers who have once bought product 'food'. | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, product_...
list the names of the customers who have once bought product 'food'.
tracking_orders
select t1.customer_name from customers as t1 join orders as t2 join order_items as t3 join products as t4 on t1.customer_id = t2.customer_id and t2.order_id = t3.order_id and t3.product_id = t4.product_id where t4.product_name = 'food' group by t1.customer_id having count(*) >= 1
Question: what are the names of the customers who bought product 'food' at least once? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. Products -> product_id, ...
what are the names of the customers who bought product 'food' at least once?
tracking_orders
select t1.customer_name from customers as t1 join orders as t2 join order_items as t3 join products as t4 on t1.customer_id = t2.customer_id and t2.order_id = t3.order_id and t3.product_id = t4.product_id where t3.order_item_status = 'cancel' and t4.product_name = 'food' group by t1.customer_id having count(*) >= 1
Question: list the names of customers who have once canceled the purchase of the product 'food' (the item status is 'cancel'). | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed,...
list the names of customers who have once canceled the purchase of the product 'food' (the item status is 'cancel').
tracking_orders
select t1.customer_name from customers as t1 join orders as t2 join order_items as t3 join products as t4 on t1.customer_id = t2.customer_id and t2.order_id = t3.order_id and t3.product_id = t4.product_id where t3.order_item_status = 'cancel' and t4.product_name = 'food' group by t1.customer_id having count(*) >= 1
Question: which customers have ever canceled the purchase of the product 'food' (the item status is 'cancel')? | Tables: Customers -> customer_id, customer_name, customer_details. Invoices -> invoice_number, invoice_date, invoice_details. Orders -> order_id, customer_id, order_status, date_order_placed, order_details. ...
which customers have ever canceled the purchase of the product 'food' (the item status is 'cancel')?
architecture
select count(*) from architect where gender = 'female'
Question: how many architects are female? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id = architect.id, mill.architect_id = architect.id,
how many architects are female?
architecture
select name , nationality , id from architect where gender = 'male' order by name
Question: list the name, nationality and id of all male architects ordered by their names lexicographically. | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.ar...
list the name, nationality and id of all male architects ordered by their names lexicographically.
architecture
select max(t1.length_meters) , t2.name from bridge as t1 join architect as t2 on t1.architect_id = t2.id
Question: what is the maximum length in meters for the bridges and what are the architects' names? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id...
what is the maximum length in meters for the bridges and what are the architects' names?
architecture
select avg(length_feet) from bridge
Question: what is the average length in feet of the bridges? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id = architect.id, mill.architect_id = a...
what is the average length in feet of the bridges?
architecture
select name , built_year from mill where type = 'grondzeiler'
Question: what are the names and year of construction for the mills of 'grondzeiler' type? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id = archi...
what are the names and year of construction for the mills of 'grondzeiler' type?
architecture
select distinct t1.name , t1.nationality from architect as t1 join mill as t2 on t1.id = t2.architect_id
Question: what are the distinct names and nationalities of the architects who have ever built a mill? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect...
what are the distinct names and nationalities of the architects who have ever built a mill?
architecture
select name from mill where location != 'donceel'
Question: what are the names of the mills which are not located in 'donceel'? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id = architect.id, mill...
what are the names of the mills which are not located in 'donceel'?
architecture
select distinct t1.type from mill as t1 join architect as t2 on t1.architect_id = t2.id where t2.nationality = 'american' or t2.nationality = 'canadian'
Question: what are the distinct types of mills that are built by american or canadian architects? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id ...
what are the distinct types of mills that are built by american or canadian architects?
architecture
select t1.id , t1.name from architect as t1 join bridge as t2 on t1.id = t2.architect_id group by t1.id having count(*) >= 3
Question: what are the ids and names of the architects who built at least 3 bridges ? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id = architect....
what are the ids and names of the architects who built at least 3 bridges ?
architecture
select t1.id , t1.name , t1.nationality from architect as t1 join mill as t2 on t1.id = t2.architect_id group by t1.id order by count(*) desc limit 1
Question: what is the id, name and nationality of the architect who built most mills? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id = architect....
what is the id, name and nationality of the architect who built most mills?
architecture
select t1.id , t1.name , t1.gender from architect as t1 join bridge as t2 on t1.id = t2.architect_id group by t1.id having count(*) = 2 union select t1.id , t1.name , t1.gender from architect as t1 join mill as t2 on t1.id = t2.architect_id group by t1.id having count(*) = 1
Question: what are the ids, names and genders of the architects who built two bridges or one mill? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id...
what are the ids, names and genders of the architects who built two bridges or one mill?
architecture
select location from bridge where name = 'kolob arch' or name = 'rainbow bridge'
Question: what is the location of the bridge named 'kolob arch' or 'rainbow bridge'? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id = architect.i...
what is the location of the bridge named 'kolob arch' or 'rainbow bridge'?
architecture
select name from mill where name like '%moulin%'
Question: which of the mill names contains the french word 'moulin'? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id = architect.id, mill.architec...
which of the mill names contains the french word 'moulin'?
architecture
select distinct t1.name from mill as t1 join architect as t2 on t1.architect_id = t2.id join bridge as t3 on t3.architect_id = t2.id where t3.length_meters > 80
Question: what are the distinct name of the mills built by the architects who have also built a bridge longer than 80 meters? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. |...
what are the distinct name of the mills built by the architects who have also built a bridge longer than 80 meters?
architecture
select type , count(*) from mill group by type order by count(*) desc limit 1
Question: what is the most common mill type, and how many are there? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id = architect.id, mill.architec...
what is the most common mill type, and how many are there?
architecture
select count(*) from architect where id not in ( select architect_id from mill where built_year < 1850 );
Question: how many architects haven't built a mill before year 1850? | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. | Joins: bridge.architect_id = architect.id, mill.architec...
how many architects haven't built a mill before year 1850?
architecture
select t1.name from bridge as t1 join architect as t2 on t1.architect_id = t2.id where t2.nationality = 'american' order by t1.length_feet
Question: show the name of all bridges that was designed by american archtect, and sort the result by the bridge feet length. | Tables: architect -> id, name, nationality, gender. bridge -> architect_id, id, name, location, length_meters, length_feet. mill -> architect_id, id, location, name, type, built_year, notes. |...
show the name of all bridges that was designed by american archtect, and sort the result by the bridge feet length.
culture_company
select count(*) from book_club
Question: how many book clubs are there? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shareholding, book_club_id, movie...
how many book clubs are there?
culture_company
select count(*) from book_club
Question: count the number of book clubs. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shareholding, book_club_id, movi...
count the number of book clubs.
culture_company
select book_title , author_or_editor from book_club where year > 1989
Question: show the titles, and authors or editors for all books made after the year 1989. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_i...
show the titles, and authors or editors for all books made after the year 1989.
culture_company
select book_title , author_or_editor from book_club where year > 1989
Question: what are the titles and authors or editors that correspond to books made after 1989? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorpora...
what are the titles and authors or editors that correspond to books made after 1989?
culture_company
select distinct publisher from book_club
Question: show all distinct publishers for books. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shareholding, book_club_...
show all distinct publishers for books.
culture_company
select distinct publisher from book_club
Question: what are all the different book publishers? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shareholding, book_c...
what are all the different book publishers?
culture_company
select year , book_title , publisher from book_club order by year desc
Question: show the years, book titles, and publishers for all books, in descending order by year. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorp...
show the years, book titles, and publishers for all books, in descending order by year.
culture_company
select year , book_title , publisher from book_club order by year desc
Question: what are the years, titles, and publishers for all books, ordered by year descending? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorpor...
what are the years, titles, and publishers for all books, ordered by year descending?
culture_company
select publisher , count(*) from book_club group by publisher
Question: show all publishers and the number of books for each publisher. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_...
show all publishers and the number of books for each publisher.
culture_company
select publisher , count(*) from book_club group by publisher
Question: how many books are there for each publisher? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shareholding, book_...
how many books are there for each publisher?
culture_company
select publisher from book_club group by publisher order by count(*) desc limit 1
Question: what is the publisher with most number of books? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shareholding, b...
what is the publisher with most number of books?
culture_company
select publisher from book_club group by publisher order by count(*) desc limit 1
Question: return the publisher that has published the most books. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Sharehol...
return the publisher that has published the most books.
culture_company
select category , count(*) from book_club group by category
Question: show all book categories and the number of books in each category. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equi...
show all book categories and the number of books in each category.
culture_company
select category , count(*) from book_club group by category
Question: how many books fall into each category? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shareholding, book_club_...
how many books fall into each category?
culture_company
select category from book_club where year > 1989 group by category having count(*) >= 2
Question: list categories that have at least two books after year 1989. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Sh...
list categories that have at least two books after year 1989.
culture_company
select category from book_club where year > 1989 group by category having count(*) >= 2
Question: what categories have two or more corresponding books that were made after 1989? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_i...
what categories have two or more corresponding books that were made after 1989?
culture_company
select publisher from book_club where year = 1989 intersect select publisher from book_club where year = 1990
Question: show publishers with a book published in 1989 and a book in 1990. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equit...
show publishers with a book published in 1989 and a book in 1990.
culture_company
select publisher from book_club where year = 1989 intersect select publisher from book_club where year = 1990
Question: what are the publishers who have published a book in both 1989 and 1990? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Grou...
what are the publishers who have published a book in both 1989 and 1990?
culture_company
select publisher from book_club except select publisher from book_club where year = 1989
Question: show all publishers which do not have a book in 1989. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shareholdi...
show all publishers which do not have a book in 1989.
culture_company
select publisher from book_club except select publisher from book_club where year = 1989
Question: which publishers did not publish a book in 1989? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shareholding, b...
which publishers did not publish a book in 1989?
culture_company
select title , year , director from movie order by budget_million
Question: show all movie titles, years, and directors, ordered by budget. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_...
show all movie titles, years, and directors, ordered by budget.
culture_company
select title , year , director from movie order by budget_million
Question: what are the titles, years, and directors of all movies, ordered by budget in millions? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorp...
what are the titles, years, and directors of all movies, ordered by budget in millions?
culture_company
select count (distinct director) from movie
Question: how many movie directors are there? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shareholding, book_club_id, ...
how many movie directors are there?
culture_company
select count (distinct director) from movie
Question: count the number of different directors. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shareholding, book_club...
count the number of different directors.
culture_company
select title , director from movie where year <= 2000 order by gross_worldwide desc limit 1
Question: what is the title and director for the movie with highest worldwide gross in the year 2000 or before? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name...
what is the title and director for the movie with highest worldwide gross in the year 2000 or before?
culture_company
select title , director from movie where year <= 2000 order by gross_worldwide desc limit 1
Question: return the title and director of the movie released in the year 2000 or earlier that had the highest worldwide gross. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company...
return the title and director of the movie released in the year 2000 or earlier that had the highest worldwide gross.
culture_company
select director from movie where year = 2000 intersect select director from movie where year = 1999
Question: show all director names who have a movie in both year 1999 and 2000. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Eq...
show all director names who have a movie in both year 1999 and 2000.
culture_company
select director from movie where year = 2000 intersect select director from movie where year = 1999
Question: which directors had a movie both in the year 1999 and 2000? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shar...
which directors had a movie both in the year 1999 and 2000?
culture_company
select director from movie where year = 1999 or year = 2000
Question: show all director names who have a movie in the year 1999 or 2000. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equi...
show all director names who have a movie in the year 1999 or 2000.
culture_company
select director from movie where year = 1999 or year = 2000
Question: which directors had a movie in either 1999 or 2000? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Shareholding...
which directors had a movie in either 1999 or 2000?
culture_company
select avg(budget_million) , max(budget_million) , min(budget_million) from movie where year < 2000
Question: what is the average, maximum, and minimum budget for all movies before 2000. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, ...
what is the average, maximum, and minimum budget for all movies before 2000.
culture_company
select avg(budget_million) , max(budget_million) , min(budget_million) from movie where year < 2000
Question: return the average, maximum, and minimum budgets in millions for movies made before the year 2000. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, T...
return the average, maximum, and minimum budgets in millions for movies made before the year 2000.
culture_company
select t1.company_name from culture_company as t1 join book_club as t2 on t1.book_club_id = t2.book_club_id where t2.publisher = 'alyson'
Question: list all company names with a book published by alyson. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Sharehol...
list all company names with a book published by alyson.
culture_company
select t1.company_name from culture_company as t1 join book_club as t2 on t1.book_club_id = t2.book_club_id where t2.publisher = 'alyson'
Question: what are all the company names that have a book published by alyson? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Eq...
what are all the company names that have a book published by alyson?
culture_company
select t1.title , t3.book_title from movie as t1 join culture_company as t2 on t1.movie_id = t2.movie_id join book_club as t3 on t3.book_club_id = t2.book_club_id where t2.incorporated_in = 'china'
Question: show the movie titles and book titles for all companies in china. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equit...
show the movie titles and book titles for all companies in china.
culture_company
select t1.title , t3.book_title from movie as t1 join culture_company as t2 on t1.movie_id = t2.movie_id join book_club as t3 on t3.book_club_id = t2.book_club_id where t2.incorporated_in = 'china'
Question: what are the titles of movies and books corresponding to companies incorporated in china? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Inco...
what are the titles of movies and books corresponding to companies incorporated in china?
culture_company
select t2.company_name from movie as t1 join culture_company as t2 on t1.movie_id = t2.movie_id where t1.year = 1999
Question: show all company names with a movie directed in year 1999. | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorporated_in, Group_Equity_Share...
show all company names with a movie directed in year 1999.
culture_company
select t2.company_name from movie as t1 join culture_company as t2 on t1.movie_id = t2.movie_id where t1.year = 1999
Question: what are all company names that have a corresponding movie directed in the year 1999? | Tables: book_club -> book_club_id, Year, Author_or_Editor, Book_Title, Publisher, Category, Result. movie -> movie_id, Title, Year, Director, Budget_million, Gross_worldwide. culture_company -> Company_name, Type, Incorpor...
what are all company names that have a corresponding movie directed in the year 1999?