Chinastark/bird_dataset huggingface dataset:
Database: movielens
Note: Female actors mean that a_gender = 'F'; Male actors mean that a_gender = 'M'; a_quality = 5 refers to act the best, a_quality = 0 refers to act the worst;
Question: What is the total amount male and female actors who were casted in movie ID 1684910 and what is the proportion between the highest quality actors against the worst quality of actors? Indicate your answer in percentage. List the the director as well as the genre.
SQL: SELECT sum(iif(a_gender = 'M', 1, 0)) , sum(iif(a_gender = 'F', 1, 0)) , cast(sum(iif(a_quality = 5, 1, 0)) AS REAL) * 100 / count(*) , cast(sum(iif(a_quality = 0, 1, 0)) AS REAL) * 100 / count(*), ( SELECT directorid FROM movies2directors WHERE movieid = 1684910 ) , ( SELECT genre FROM movies2directors WHERE movieid = 1684910 ) FROM actors WHERE actorid IN ( SELECT actorid FROM movies2actors WHERE movieid = 1684910 )
Database: superstore
Note: names of all the products refers to "product name"; order CA-2011-112326 refers to "order id" = 'CA-2011-112326'; in the center refers to region = 'Central';
Question: Please list the names of all the products ordered in order CA-2011-112326 in superstores in the center.
SQL: SELECT DISTINCT product.`product name` FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE central_superstore.`order id` = 'CA-2011-112326'
Database: superstore
Note: made by Aimee Bixby refers to "customer name" = 'Aimee Bixby'; longest shipment time refers to MAX(SUM(SUTRACT(julianday("ship date"), julianday("order date")), 1));
Question: Among all the orders made by Aimee Bixby, what was the longest shipment time?
SQL: SELECT max(strftime('%J', `ship date`) - strftime('%J', `order date`)) AS longesttimedays FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` WHERE people.`customer name` = 'Aimee Bixby'
Database: superstore
Note: made by Aimee Bixby refers to "customer name" = 'Aimee Bixby'; the slowest delivery speed refers to "ship mode" = 'Standard Class';
Question: Among all the orders made by Aimee Bixby, how many of them chose the slowest delivery speed?
SQL: SELECT count(DISTINCT central_superstore.`order id`) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` WHERE people.`customer name` = 'Aimee Bixby' AND central_superstore.`ship mode` = 'Standard Class'
Database: superstore
Note: Aimee Bixby made refers to "customer name" = 'Aimee Bixby';
Question: How many orders has Aimee Bixby made?
SQL: SELECT count(DISTINCT central_superstore.`order id`) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` WHERE people.`customer name` = 'Aimee Bixby'
Database: superstore
Note: made by Aimee Bixby refers to "customer name" = 'Aimee Bixby'; with more than 3 kinds of products ordered refers to count("product id") > 3;
Question: Please list the IDs of the orders made by Aimee Bixby with more than 3 kinds of products ordered.
SQL: SELECT DISTINCT central_superstore.`order id` FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` WHERE people.`customer name` = 'Aimee Bixby' GROUP BY central_superstore.`product id` HAVING count(central_superstore.`product id`) > 3
Database: superstore
Note: made by Aimee Bixby refers to "customer name" = 'Aimee Bixby';
Question: Among the orders made by Aimee Bixby, how many of them included at least one kind of product under the category "Furniture"?
SQL: SELECT count(DISTINCT central_superstore.`order id`) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` INNER JOIN product ON product.`product id` = central_superstore.`product id` WHERE product.category = 'Furniture' AND people.`customer name` = 'Aimee Bixby'
Database: superstore
Note: ordered by Aimee Bixby refers to "customer name" = 'Aimee Bixby'; ordered n 2016 refers to strftime('%Y', "order date") = '2016';
Question: Please list the names of all the products ordered by Aimee Bixby in 2016.
SQL: SELECT DISTINCT product.`product name` FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` INNER JOIN product ON product.`product id` = central_superstore.`product id` WHERE people.`customer name` = 'Aimee Bixby' AND strftime('%Y', central_superstore.`ship date`) = '2016'
Database: superstore
Note: "Telescoping Adjustable Floor Lamp" is a "product name"; from central superstores refers to region = 'Central';
Question: What is the total quantity of "Telescoping Adjustable Floor Lamp" ordered from central superstores?
SQL: SELECT sum(central_superstore.quantity) FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE product.`product name` = 'Telescoping Adjustable Floor Lamp'
Database: superstore
Note: "Telescoping Adjustable Floor Lamp" is a product name; names of all the customers refers to "customer name";
Question: Please list the names of all the customers who had ordered the product "Telescoping Adjustable Floor Lamp".
SQL: SELECT DISTINCT people.`customer name` FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` INNER JOIN product ON product.`product id` = central_superstore.`product id` WHERE product.`product name` = 'Telescoping Adjustable Floor Lamp'
Database: superstore
Note: "Telescoping Adjustable Floor Lamp" is a "product name"; consumers refers to segment = 'Consumer';
Question: Among the customers who have ordered the product "Telescoping Adjustable Floor Lamp", how many of them are consumers?
SQL: SELECT count(DISTINCT people.`customer name`) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` INNER JOIN product ON product.`product id` = central_superstore.`product id` WHERE product.`product name` = 'Telescoping Adjustable Floor Lamp' AND people.segment = 'Consumer'
Database: superstore
Note: Xerox 1952 is a "product name"; ordered by Aimee Bixby refers to "customer name" = 'Aimee Bixby'; on 2014/9/10 refers to "order date" = date('2014-09-10');
Question: What was the quantity of Xerox 1952 ordered by Aimee Bixby on 2014/9/10?
SQL: SELECT sum(central_superstore.quantity) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` INNER JOIN product ON product.`product id` = central_superstore.`product id` WHERE people.`customer name` = 'Aimee Bixby' AND product.`product name` = 'Xerox 1952' AND central_superstore.`order date` = '2014-09-10'
Database: superstore
Note: Xerox 1952 is a "product name"; Aimee Bixby ordered refers to "customer name" = 'Aimee Bixby';
Question: For how many times has Aimee Bixby ordered the product Xerox 1952?
SQL: SELECT count(DISTINCT central_superstore.`order id`) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` INNER JOIN product ON product.`product id` = central_superstore.`product id` WHERE people.`customer name` = 'Aimee Bixby' AND product.`product name` = 'Xerox 1952'
Database: superstore
Note: Xerox 1952 is a "product name"; ordered by Aimee Bixby refers to "customer name" = 'Aimee Bixby'; on 2014/9/10 refers to "order date" = date('2014-09-10'); original price refers to DIVIDE(sales, SUTRACT(1, discount));
Question: What was the original price of Xerox 1952 ordered by Aimee Bixby on 2014/9/10?
SQL: SELECT DISTINCT central_superstore.sales / (1 - central_superstore.discount) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` INNER JOIN product ON product.`product id` = central_superstore.`product id` WHERE people.`customer name` = 'Aimee Bixby' AND product.`product name` = 'Xerox 1952' AND central_superstore.`order date` = '2014-09-10'
Database: superstore
Note: Xerox 1952 is a "product name"; ordered by Aimee Bixby refers to "customer name" = 'Aimee Bixby'; on 2014/9/10 refers to "order date" = date('2014-09-10'); total cost refers to SUTRACT(MULTIPLY(DIVIDE(sales, SUTRACT(1, discount)), quantity), profit);
Question: What was the total cost of Xerox 1952 ordered by Aimee Bixby on 2014/9/10?
SQL: SELECT DISTINCT (central_superstore.sales / (1 - central_superstore.discount)) * central_superstore.quantity - profit FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` INNER JOIN product ON product.`product id` = central_superstore.`product id` WHERE people.`customer name` = 'Aimee Bixby' AND product.`product name` = 'Xerox 1952' AND central_superstore.`order date` = '2014-09-10'
Database: superstore
Note: ordered in 2013 refers to strftime('%Y', "order date") = '2013'; art products refers to "sub-category" = 'Art';
Question: How many art products were ordered in 2013 in the east superstore?
SQL: SELECT count(DISTINCT east_superstore.`product id`) FROM east_superstore INNER JOIN product ON east_superstore.`product id` = product.`product id` WHERE product.`sub-category` = 'Art' AND east_superstore.region = 'East' AND strftime('%Y', east_superstore.`order date`) = '2013'
Database: superstore
Note: largest total cost refers to MAX(SUTRACT(MULTIPLY(DIVIDE(sales, SUTRACT(1, discount)), quantity), profit));
Question: Who is the customer who purchased the largest total cost of products in a single order?
SQL: SELECT people.`customer name` FROM east_superstore INNER JOIN people ON east_superstore.`customer id` = people.`customer id` GROUP BY east_superstore.`order id`, people.`customer name` ORDER BY sum((east_superstore.sales / (1 - east_superstore.discount)) * east_superstore.quantity - east_superstore.profit) DESC LIMIT 1
Database: superstore
Note: has the highest original price refers to MAX(DIVIDE(sales, SUTRACT(1, discount))); name of the product refers to "product name";
Question: What is the name of the product that has the highest original price?
SQL: SELECT product.`product name` FROM east_superstore INNER JOIN product ON east_superstore.`product id` = product.`product id` ORDER BY (east_superstore.sales / (1 - east_superstore.discount)) DESC LIMIT 1
Database: superstore
Note: Darren Powers is the "customer name"; name of the product refers to "product name"; recently refers to MAX("order date");
Question: What is the name of the product that was ordered recently by Darren Powers?
SQL: SELECT product.`product name` FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` INNER JOIN product ON product.`product id` = central_superstore.`product id` WHERE people.`customer name` = 'Darren Powers' ORDER BY central_superstore.`order date` DESC LIMIT 1
Database: superstore
Note: Advantus plastic paper clips is the "product name";
Question: How many quantities of Advantus plastic paper clips were ordered overall?
SQL: SELECT sum(central_superstore.quantity) FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE product.`product name` = 'Advantus Plastic Paper Clips'
Database: superstore
Note: Logitech G600 MMO Gaming Mouse refers to "product name"; highest total cost refers to MAX(SUTRACT(MULTIPLY(DIVIDE(sales, SUTRACT(1, discount)), quantity), profit));
Question: Which order of Logitech G600 MMO Gaming Mouse has the highest total cost?
SQL: SELECT central_superstore.`order id` FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE product.`product name` = 'Logitech G600 MMO Gaming Mouse' GROUP BY central_superstore.`order id` ORDER BY sum((central_superstore.sales / (1 - central_superstore.discount)) * central_superstore.quantity - central_superstore.profit) DESC LIMIT 1
Database: superstore
Note: ordered by Alejandro Grove refers to "customer name" = 'Alejandro Grove'; names of the products refers to "product name";
Question: What are the names of the products that were ordered by Alejandro Grove?
SQL: SELECT DISTINCT product.`product name` FROM west_superstore INNER JOIN people ON west_superstore.`customer id` = people.`customer id` INNER JOIN product ON product.`product id` = west_superstore.`product id` WHERE people.`customer name` = 'Alejandro Grove'
Database: superstore
Note: at least 10 goods refers to quantity >= 14; Cardinal EasyOpen D-Ring Binders refers to "product name"; customers in Chicago refers to city = 'Chicago';
Question: How many customers in Chicago ordered at least 10 Cardinal EasyOpen D-Ring Binders in a single order?
SQL: SELECT count(DISTINCT west_superstore.`customer id`) FROM west_superstore INNER JOIN people ON west_superstore.`customer id` = people.`customer id` INNER JOIN product ON product.`product id` = west_superstore.`product id` WHERE product.`product name` = 'Cardinal EasyOpen D-Ring Binders' AND people.city = 'Chicago' AND west_superstore.quantity > 10
Database: superstore
Note: profit of no less than 1,000 refers to profit >= 1000; names of the products refers to "product name";
Question: What are the names of the products with a profit of no less than 1,000 in one single order?
SQL: SELECT DISTINCT product.`product name` FROM west_superstore INNER JOIN product ON west_superstore.`product id` = product.`product id` WHERE west_superstore.profit > 1000
Database: superstore
Note: shipped first class refers to "ship mode" = 'First Class'; region = 'East';
Question: Name 10 products that were shipped first class from the East region.
SQL: SELECT product.`product name` FROM east_superstore INNER JOIN product ON east_superstore.`product id` = product.`product id` WHERE east_superstore.`ship mode` = 'First Class' AND product.region = 'East' LIMIT 10
Database: superstore
Note: ordered by Becky Martin refers to "customer name" = 'Becky Martin'; region = 'Central'; products refers to "product name";
Question: List the products ordered by Becky Martin around the Central region.
SQL: SELECT DISTINCT product.`product name` FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` INNER JOIN product ON product.`product id` = central_superstore.`product id` WHERE people.`customer name` = 'Becky Martin' AND product.region = 'Central'
Database: superstore
Note: shipped 'Second Class.' refers to "ship mode" = 'Second Class'; customers refers to "customer name"; region = 'West';
Question: List 5 customers in the West region who had their item shipped 'Second Class.'
SQL: SELECT DISTINCT people.`customer name` FROM west_superstore INNER JOIN people ON west_superstore.`customer id` = people.`customer id` WHERE west_superstore.region = 'West' AND west_superstore.`ship mode` = 'Second Class' LIMIT 5
Database: superstore
Note: Patrick Gardner is the "customer name"; region = 'Central';
Question: Add the total profit of Patrick Gardner in the Central region.
SQL: SELECT sum(central_superstore.profit) FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` WHERE people.`customer name` = 'Patrick Gardner' AND people.region = 'Central'
Database: superstore
Note: shipped on 3/4/2013 refers to "order date" = date('2013-03-04'); same day delivery refers to "ship mode" = 'Same Day'; item refers to "product name";
Question: Which item was shipped on 3/4/2013 and scheduled for same day delivery in the South region?
SQL: SELECT product.`product name` FROM south_superstore INNER JOIN product ON south_superstore.`product id` = product.`product id` WHERE south_superstore.`ship date` = '2013-03-04' AND product.region = 'South' AND south_superstore.`order date` = '2013-03-04'
Database: superstore
Note: 'Avery Hi-Liter EverBold Pen Style Fluorescent Highlighters, 4/Pack' is the "product name";
Question: What is the total sales of 'Avery Hi-Liter EverBold Pen Style Fluorescent Highlighters, 4/Pack' in the Central region?
SQL: SELECT sum(central_superstore.sales) FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE product.`product name` = 'Avery Hi-Liter EverBold Pen Style Fluorescent Highlighters, 4/Pack' AND product.region = 'Central'
Database: superstore
Note: Jonathan Doherty is the "customer name"; highest quantity refers to MAX(quantity); region = 'East';
Question: Name the item ordered by Jonathan Doherty with the highest quantity in the East region.
SQL: SELECT product.`product name` FROM east_superstore INNER JOIN people ON east_superstore.`customer id` = people.`customer id` INNER JOIN product ON product.`product id` = east_superstore.`product id` WHERE people.`customer name` = 'Jonathan Doherty' AND people.region = 'East' ORDER BY east_superstore.quantity DESC LIMIT 1
Database: superstore
Note: shipped on 3/25/2015 refers to "ship date" = Date('2015-03-25');
Question: How much is the total quantity of items from the East region shipped on 3/25/2015? Name the products.
SQL: SELECT sum(east_superstore.quantity), product.`product name` FROM east_superstore INNER JOIN product ON east_superstore.`product id` = product.`product id` WHERE east_superstore.`ship date` = '2015-03-25' AND product.region = 'East'
Database: superstore
Note: 'Global High-Back Leather Tilter, Burgundy' is the "product name"; on 10/13/2013 refers to "order date" = Date('2013-10-13'); region = 'East';
Question: Which customer ordered 'Global High-Back Leather Tilter, Burgundy' on 10/13/2013 in the East region?
SQL: SELECT DISTINCT people.`customer name` FROM east_superstore INNER JOIN people ON east_superstore.`customer id` = people.`customer id` INNER JOIN product ON product.`product id` = east_superstore.`product id` WHERE product.`product name` = 'Global High-Back Leather Tilter, Burgundy' AND east_superstore.`order date` = '2013-10-13' AND east_superstore.region = 'East'
Database: superstore
Note: ordered by Katherine Murray refers to "customer name" = 'Katherine Murray'; on 11/4/2018 refers to "order date" = Date('2018-11-04');
Question: What category does the item ordered by Katherine Murray on 11/4/2018 in the South region belong to?
SQL: SELECT DISTINCT product.category FROM south_superstore INNER JOIN people ON south_superstore.`customer id` = people.`customer id` INNER JOIN product ON product.`product id` = south_superstore.`product id` WHERE people.`customer name` = 'Katherine Murray' AND south_superstore.`order date` = '2018-11-04' AND people.region = 'South'
Database: superstore
Note: shipped as standard refers to "ship mode" = 'Standard Class'; region = 'West'; percentage refers to DIVIDE(SUM(quantity where category = 'Furniture'), SUM(quantity)) * 1.0;
Question: What percentage do items under the category of 'Furniture' make up the total number of items ordered that are shipped as standard in the West region?
SQL: SELECT cast(sum(CASE  WHEN product.category = 'Furniture' THEN 1 ELSE 0 END) AS REAL) * 100 / sum(west_superstore.quantity) FROM west_superstore INNER JOIN product ON west_superstore.`product id` = product.`product id` WHERE product.region = 'West' AND west_superstore.`ship mode` = 'Standard Class'
Database: superstore
Note: Ann Chong' is the "customer name"; region = 'Central';
Question: What is the ship date of the order by the customer named Ann Chong in the central region?
SQL: SELECT central_superstore.`ship date` FROM people INNER JOIN central_superstore ON people.`customer id` = central_superstore.`customer id` WHERE people.`customer name` = 'Ann Chong' AND people.region = 'Central'
Database: superstore
Note: region = 'West';
Question: Give the customer segment from the West region that orders the order ID CA-2011-108189.
SQL: SELECT DISTINCT people.segment FROM west_superstore INNER JOIN people ON west_superstore.`customer id` = people.`customer id` WHERE west_superstore.region = 'West' AND west_superstore.`order id` = 'CA-2011-108189'
Database: superstore
Note: 'Hon Valutask Swivel Chairs' is the "product name";
Question: What are the total sales of the accumulated orders of Hon Valutask Swivel Chairs in the West region?
SQL: SELECT sum(west_superstore.sales) FROM west_superstore INNER JOIN product ON west_superstore.`product id` = product.`product id` WHERE product.`product name` = 'Hon Valutask Swivel Chairs' AND west_superstore.region = 'West'
Database: superstore
Note: Frank Olsen' is the "customer name"; region = 'South';
Question: Provide the order ID of Frank Olsen of the South region.
SQL: SELECT south_superstore.`order id` FROM south_superstore INNER JOIN people ON south_superstore.`customer id` = people.`customer id` WHERE people.region = 'South' AND people.`customer name` = 'Frank Olsen'
Database: superstore
Note: on April 26, 2018 refers to "order date" = date('2018-04-26'); shipped by April 27, 2018 refers to "ship date" = date('2018-04-27');
Question: What product was ordered in the Central region on April 26, 2018, and shipped by April 27, 2018?
SQL: SELECT product.`product name` FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE central_superstore.`order date` = '2018-04-26' AND central_superstore.`ship date` = '2018-04-27' AND product.region = 'Central'
Database: superstore
Note: highest sales refers to max(sales);
Question: From which city and state does the customer that bought the product with the highest sales?
SQL: SELECT people.city, people.state FROM west_superstore INNER JOIN east_superstore ON west_superstore.`customer id` = east_superstore.`customer id` INNER JOIN central_superstore ON central_superstore.`customer id` = east_superstore.`customer id` INNER JOIN south_superstore ON south_superstore.`customer id` = central_superstore.`customer id` INNER JOIN people ON people.`customer id` = south_superstore.`customer id` ORDER BY east_superstore.sales DESC LIMIT 1
Database: superstore
Note: highest profit refers to MAX(profit); region = 'East';
Question: Who is the customer from the East region that purchased the order with the highest profit?
SQL: SELECT people.`customer name` FROM east_superstore INNER JOIN people ON east_superstore.`customer id` = people.`customer id` WHERE east_superstore.region = 'East' ORDER BY east_superstore.profit DESC LIMIT 1
Database: superstore
Note: from Chicago refers to city = 'Chicago'; Illinois refers to state = 'Illinois'; highest quantity refers to max(quantity);
Question: Among the customers from Chicago, Illinois, what is the highest quantity of products bought in a single order?
SQL: SELECT west_superstore.quantity FROM west_superstore INNER JOIN east_superstore ON west_superstore.`customer id` = east_superstore.`customer id` INNER JOIN central_superstore ON central_superstore.`customer id` = east_superstore.`customer id` INNER JOIN south_superstore ON south_superstore.`customer id` = central_superstore.`customer id` INNER JOIN people ON people.`customer id` = south_superstore.`customer id` WHERE people.city = 'Chicago' AND people.state = 'Illinois' ORDER BY west_superstore.quantity DESC LIMIT 1
Database: superstore
Question: What are the order date and product name of the order ID CA-2011-137274 from the Central region?
SQL: SELECT central_superstore.`order date`, product.`product name` FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE central_superstore.`order id` = 'CA-2011-137274' AND product.region = 'Central'
Database: superstore
Note: product named Xerox 23 refers to "product name" = 'Xerox 23'; customers refers to "customer name";
Question: List down the customers that purchased the product named Xerox 23 in the South region.
SQL: SELECT DISTINCT people.`customer name` FROM south_superstore INNER JOIN people ON south_superstore.`customer id` = people.`customer id` INNER JOIN product ON product.`product id` = south_superstore.`product id` WHERE south_superstore.region = 'South' AND product.`product name` = 'Xerox 23'
Database: superstore
Note: made the highest sales refers to MAX(sales);
Question: Among the products under the office supplies category, what is the product that made the highest sales in the Central region?
SQL: SELECT product.`product name` FROM central_superstore INNER JOIN product ON central_superstore.`product id` = product.`product id` WHERE product.category = 'Office Supplies' AND product.region = 'Central' ORDER BY central_superstore.sales DESC LIMIT 1