Chinastark/bird_dataset huggingface dataset:
Database: retail_world
Note: discontinued products refers to Discontinued = 1; calculation = DIVIDE(SUM(Discontinued = 1), COUNT(productid)) * 100;
Question: Find the percentage of discontinued products in Northwind's portfolio of products.
SQL: SELECT cast(count(CASE WHEN discontinued = 1 THEN 1 ELSE NULL END) AS REAL) * 100 / count(productid) FROM products
Database: retail_world
Note: full name refers to firstname, lastname; sales order with ID 10274 refers to orderid = 10274;
Question: Provide the full name of the employee who processed the sales order with ID 10274.
SQL: SELECT employees.firstname, employees.lastname FROM employees INNER JOIN orders ON employees.employeeid = orders.employeeid WHERE orders.orderid = 10274
Database: retail_world
Note: 'GROSELLA-Restaurante' refers to CompanyName;
Question: Calculate the total number of orders placed by the company 'GROSELLA-Restaurante'.
SQL: SELECT count(orders.orderid) FROM customers INNER JOIN orders ON customers.customerid = orders.customerid WHERE customers.companyname = 'GROSELLA-Restaurante'
Database: retail_world
Note: name products refers to productname; 'GROSELLA-Restaurante' refers to CompanyName; 'Nancy Davolio' is the full name of an employee; full name refers to firstname, lastname;
Question: Name products and their quantity ordered by the company 'GROSELLA-Restaurante' in the sales order that was processed by Nancy Davolio.
SQL: SELECT products.productname, order details.quantity FROM employees INNER JOIN orders ON employees.employeeid = orders.employeeid INNER JOIN `order details` ON orders.orderid = order details.orderid INNER JOIN products ON order details.productid = products.productid INNER JOIN customers ON orders.customerid = customers.customerid WHERE employees.firstname = 'Nancy' AND employees.lastname = 'Davolio' AND customers.companyname = 'GROSELLA-Restaurante'
Database: retail_world
Note: 'Laughing Bacchus Wine Cellars' refers to CompanyName; calculation = DIVIDE(SUM(unitprice * quantity * SUBTRACT(1, Discount)), COUNT(orderid));
Question: Identify the total number of orders placed by the customer 'Laughing Bacchus Wine Cellars' and it's average value.
SQL: SELECT count(orders.orderid) , sum(order details.unitprice * order details.quantity * (1 - order details.discount)) / count(orders.orderid) FROM customers INNER JOIN orders ON customers.customerid = orders.customerid INNER JOIN `order details` ON orders.orderid = order details.orderid WHERE customers.companyname = 'Laughing Bacchus Wine Cellars'
Database: retail_world
Note: 'Pavlova' is a productname;
Question: How many boxes of 'Pavlova' did Northwind sell?
SQL: SELECT count(order details.quantity) FROM products INNER JOIN `order details` ON products.productid = order details.productid WHERE products.productname = 'Pavlova'
Database: retail_world
Note: salary range is BETWEEN max(Salary) AND min(Salary); sales representative is a title;
Question: What is the salary range for sales representative in Northwind?
SQL: SELECT ( SELECT min(salary) FROM employees WHERE title = 'Sales Representative' ) AS MIN , ( SELECT max(salary) FROM employees WHERE title = 'Sales Representative' ) AS MAX
Database: retail_world
Note: 'USA' is a country; supplier refers to CompanyName;
Question: How many suppliers does Northwind have in USA?
SQL: SELECT count(supplierid) FROM suppliers WHERE country = 'USA'
Database: retail_world
Note: no longer sold refers to Discontinued = 1; products refers to productname;
Question: What products are no longer sold by Northwind?
SQL: SELECT productname FROM products WHERE discontinued = 1
Database: retail_world
Note: 'Eastern Connection' is a CompanyName; 'Sales Agent' is a ContactTitle;
Question: Who is the Sales Agent for the company 'Eastern Connection'?
SQL: SELECT contactname FROM customers WHERE companyname = 'Eastern Connection' AND contacttitle = 'Sales Agent'
Database: retail_world
Note: companies refers to shipperid;
Question: How many companies do ship Northwind's orders?
SQL: SELECT count(shipperid) FROM shippers
Database: retail_world
Note: 'Andrew Fuller' is the full name of an employee; full name refers to FistName, lastname; Austria refers to Shipcountry; calculation = DIVIDE(SUM(Shipcountry = 'Austria'), COUNT(orderid)) * 100;
Question: Identify the total number of orders processed by Northwind employee named Andrew Fuller. What percent of those orders was shipped to Austria?
SQL: SELECT cast(count(CASE WHEN orders.shipcountry = 'Austria' THEN 1 ELSE NULL END) AS REAL) * 100 / count(orders.orderid) FROM employees INNER JOIN orders ON employees.employeeid = orders.employeeid WHERE employees.firstname = 'Andrew' AND employees.lastname = 'Fuller'
Database: retail_world
Note: Soft drinks, coffees, teas, beers, and ales' is description of categoryname;
Question: Indicate category name of soft drinks, coffees, teas, beers, and ales in description list.
SQL: SELECT categoryname FROM categories WHERE description = 'Soft drinks, coffees, teas, beers, and ales'
Database: retail_world
Note: phone number refers to phone; 'Around the Horn' is a CompanyName;
Question: List the phone number of company named Around the Horn.
SQL: SELECT phone FROM customers WHERE companyname = 'Around the Horn'
Database: retail_world
Note: 'Blondesddsl pre et fils' is a CompanyName;
Question: Indicate the fax of the company Blondesddsl pre et fils in Strasbourg city.
SQL: SELECT fax FROM customers WHERE companyname = 'Blondesddsl pre et fils' AND city = 'Strasbourg'
Database: retail_world
Note: companies refers to CompanyName;
Question: How many companies are there in the city of London?
SQL: SELECT count(companyname) FROM customers WHERE city = 'London'
Database: retail_world
Note: 'Eastern Connection' is a CompanyName; 'Ann Devon' is the full name of an employee; full name refers to firstname, lastname;
Question: Indicate the address of the company Eastern Connection whose contact name is Ann Devon.
SQL: SELECT address FROM customers WHERE companyname = 'Eastern Connection' AND contactname = 'Ann Devon'
Database: retail_world
Note: company refers to CompanyName; France is a country;
Question: Indicate which company is located in France?
SQL: SELECT companyname FROM customers WHERE country = 'France'
Database: retail_world
Note: 'Exotic Liquids' is a CompanyName;
Question: How many product names does the supplier Exotic Liquids have?
SQL: SELECT count(products.productname) FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE suppliers.companyname = 'Exotic Liquids'
Database: retail_world
Note: name of the company refers to CompanyName; the highest unit price refers to MAX(unitprice);
Question: What is the name of the company that has the product with the highest unit price?
SQL: SELECT suppliers.companyname FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE products.unitprice = ( SELECT max(unitprice) FROM products )
Database: retail_world
Note: the most stocked products refers to MAX(unitsInStock);
Question: Which company name in London city has the most stocked products?
SQL: SELECT suppliers.companyname FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE suppliers.city = 'London' ORDER BY products.unitsinstock DESC LIMIT 1
Database: retail_world
Note: 'Exotic Liquids' is a CompanyName; the highest reorder levels refers to MAX(ReorderLevel);
Question: Which product of Exotic Liquids company that have the highest reorder levels?
SQL: SELECT products.productname FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE suppliers.companyname = 'Exotic Liquids' ORDER BY products.reorderlevel DESC LIMIT 1
Database: retail_world
Note: 'Chef Anton's Gumbo Mix' is a productname; 'New Orleans Cajun Delights' is a CompanyName;
Question: Provide the category name of the Chef Anton's Gumbo Mix product that New Orleans Cajun Delights company has.
SQL: SELECT categories.categoryname FROM suppliers INNER JOIN products ON suppliers.supplierid = products.supplierid INNER JOIN categories ON products.categoryid = categories.categoryid WHERE suppliers.companyname = 'New Orleans Cajun Delights' AND products.productname LIKE 'Chef Anton%s Gumbo Mix'
Database: retail_world
Note: 'Leka Trading' is a CompanyName; 'Ipoh Coffee' is a productname;
Question: Indicate the name of the country where Leka Trading supplies Ipoh Coffee product.
SQL: SELECT suppliers.country FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE products.productname = 'Ipoh Coffee' AND suppliers.companyname = 'Leka Trading'
Database: retail_world
Question: Indicate the category name of the product name with the highest units on order.
SQL: SELECT categories.categoryname FROM products INNER JOIN categories ON products.categoryid = categories.categoryid WHERE products.unitsonorder = ( SELECT max(products.unitsonorder) FROM products )
Database: retail_world
Note: Chef Anton's Cajun Seasoning' AND 'Chef Anton''s Gumbo Mix' are productname; 'New Orleans Cajun Delights' is a CompanyName; calculation = SUBTRACT(unitprice where productname = 'Chef Anton's Cajun Seasoning', unitprice where productname = 'Chef Anton''s Gumbo Mix');
Question: What is the difference in number of unit price from Chef Anton's Cajun Seasoning product and Chef Anton's Gumbo Mix product of New Orleans Cajun Delights company.
SQL: SELECT ( SELECT products.unitprice FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE suppliers.companyname = 'New Orleans Cajun Delights' AND products.productname LIKE 'Chef Anton%s Cajun Seasoning' ) - ( SELECT products.unitprice FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE suppliers.companyname = 'New Orleans Cajun Delights' AND products.productname LIKE 'Chef Anton%s Gumbo Mix' ) AS calu
Database: retail_world
Note: Cooperativa de Quesos 'Las Cabras'' is a CompanyName; unit price greater than 20 refers to unitprice > 20;
Question: Which of Cooperativa de Quesos 'Las Cabras' products have a unit price greater than 20?
SQL: SELECT products.productname FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE suppliers.companyname LIKE 'Cooperativa de Quesos%' AND products.unitprice > 20
Database: retail_world
Note: 'Tokyo Traders' is a CompanyName; order quantity greater than 40 refers to quantity > 40;
Question: Please indicate the product name of Tokyo Traders company with order quantity greater than 40.
SQL: SELECT DISTINCT products.productname FROM suppliers INNER JOIN products ON suppliers.supplierid = products.supplierid INNER JOIN `order details` ON products.productid = order details.productid WHERE suppliers.companyname = 'Tokyo Traders' AND order details.quantity > 40
Database: retail_world
Note: 'Exotic Liquids' is a CompanyName; units in stock over 100 refers to unitsInStock > 100;
Question: List all category name of Exotic Liquids 's product with units in stock over 100.
SQL: SELECT categories.categoryname FROM suppliers INNER JOIN products ON suppliers.supplierid = products.supplierid INNER JOIN categories ON products.categoryid = categories.categoryid WHERE products.unitsinstock > 100 AND suppliers.companyname = 'Exotic Liquids'
Database: retail_world
Note: order quantity less than 50 refers to quantity < 50; Calculation = DIVIDE(SUM(quantity < 50), SUM(productid)) * 100;
Question: How many product names have order quantity less than 50? Calculate the percentage of orders less than 50 out of total order quantity.
SQL: SELECT sum(CASE WHEN order details.quantity < 50 THEN 1 ELSE 0 END) , cast(sum(if(order details.quantity < 50, 1, 0)) AS REAL) / count(products.productid) FROM products INNER JOIN `order details` ON products.productid = order details.productid
Database: retail_world
Note: 'Geitost' is a productname; calculation = DIVIDE(productname = 'Geitost', COUNT(productid)) * 100;
Question: Please indicate total order quantity of product Geitost and calculate the percentage of such product among all the order quantity.
SQL: SELECT sum(if(products.productname = 'Geitost', 1, 0)) AS SUM , cast(sum(if(products.productname = 'Geitost', 1, 0)) AS REAL) / count(products.productid) FROM products INNER JOIN `order details` ON products.productid = order details.productid
Database: retail_world
Note: 'Robert King' is the full name of an employee; full name refers to firstname, lastname; position refers to Title;
Question: What is the position of Robert King?
SQL: SELECT title FROM employees WHERE firstname = 'Robert' AND lastname = 'King'
Database: retail_world
Note: telephone number of (503) 555-9931 refers to phone = '(503) 555-9931';
Question: Write the shipping company name with the telephone number of (503) 555-9931.
SQL: SELECT companyname FROM shippers WHERE phone = '(503) 555-9931'
Database: retail_world
Note: Margaret Peacock is the full name of an employee; full name refers to firstname, lastname; phone number refers to Homephone;
Question: Write the address and phone number of Margaret Peacock.
SQL: SELECT address, homephone FROM employees WHERE firstname = 'Margaret' AND lastname = 'Peacock'
Database: retail_world
Note: full address refers to Shipaddress, Shipcity, ShipRegion,Shippostalcode, Shipcountry; 'Rattlesnake Canyon Grocery' is a ShipName;
Question: What is the full address of Rattlesnake Canyon Grocery?
SQL: SELECT DISTINCT shipaddress, shipcity, shipregion, shippostalcode, shipcountry FROM orders WHERE shipname = 'Rattlesnake Canyon Grocery'
Database: retail_world
Note: 'Confections' is a CompanyName;
Question: List all product names under Confections.
SQL: SELECT products.productname FROM products INNER JOIN categories ON products.categoryid = categories.categoryid WHERE categories.categoryname = 'Confections'
Database: retail_world
Note: 'Sir Rodney's Marmalade' is a productname; company refers to CompanyName; contact for a company refers to contactname;
Question: Sir Rodney's Marmalade is supplied by which company and who is the contact for this company?
SQL: SELECT suppliers.companyname, suppliers.contactname FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE products.productname LIKE 'Sir Rodney%s Marmalade'
Database: retail_world
Note: full name refers to firstname, lastname; Denver is a Territorydescription;
Question: What is the full name of the employee who is in charge of the territory of Denver?
SQL: SELECT employees.firstname, employees.lastname FROM employees INNER JOIN employeeterritories ON employees.employeeid = employeeterritories.employeeid INNER JOIN territories ON employeeterritories.territoryid = territories.territoryid WHERE territories.territorydescription = 'Denver'
Database: retail_world
Note: territories refers to Territorydescription; Laura Callahan is the full name of an employee; full name refers to firstname, lastname;
Question: List all the territories where Laura Callahan is in charge.
SQL: SELECT territories.territorydescription FROM employees INNER JOIN employeeterritories ON employees.employeeid = employeeterritories.employeeid INNER JOIN territories ON employeeterritories.territoryid = territories.territoryid WHERE employees.firstname = 'Laura' AND employees.lastname = 'Callahan'
Database: retail_world
Note: 'Federal Shipping' is a CompanyName; orders refers to orderid;
Question: How many orders were shipped via Federal Shipping?
SQL: SELECT count(orders.orderid) FROM orders INNER JOIN shippers ON orders.shipvia = shippers.shipperid WHERE shippers.companyname = 'Federal Shipping' AND orders.shipvia = 3
Database: retail_world
Note: 'Finland' is a country; product refers to productname; suppliers refers to supplierid;
Question: Name the products where the suppliers come from Finland.
SQL: SELECT products.productname FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE suppliers.country = 'Finland'
Database: retail_world
Note: Mozzarella di Giovanni' is a productname; category refers to categoryname;
Question: The product 'Mozzarella di Giovanni' belongs in which category? Include the category's description as well.
SQL: SELECT categories.categoryname, categories.description FROM products INNER JOIN categories ON products.categoryid = categories.categoryid WHERE products.productname = 'Mozzarella di Giovanni'
Database: retail_world
Note: suppliers refers to CompanyName; 'cheeses' is a description;
Question: Name the suppliers that supply products under the category 'cheeses.'
SQL: SELECT DISTINCT suppliers.companyname FROM suppliers INNER JOIN products ON suppliers.supplierid = products.supplierid INNER JOIN categories ON products.categoryid = categories.categoryid WHERE categories.description = 'Cheeses'
Database: retail_world
Note: products refers to productname; 'Zaanse Snoepfabriek' is a CompanyName;
Question: Name all products supplied by Zaanse Snoepfabriek.
SQL: SELECT products.productname FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE suppliers.companyname = 'Zaanse Snoepfabriek'
Database: retail_world
Note: products refers to productname; 'Plutzer Lebensmittelgromrkte AG' is a CompanyName; price refers to unitprice;  discontinued products refers to discontinued = 1;
Question: Which products by Plutzer Lebensmittelgromrkte AG were discontinued and what are their price?
SQL: SELECT products.unitprice FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE suppliers.companyname = 'Plutzer Lebensmittelgromrkte AG' AND products.discontinued = 1
Database: retail_world
Note: cities refers to Shipcity; 'Mishi Kobe Niku' is a productname;
Question: List the cities where the product 'Mishi Kobe Niku' were shipped to.
SQL: SELECT orders.shipcity FROM orders INNER JOIN `order details` ON orders.orderid = order details.orderid INNER JOIN products ON order details.productid = products.productid WHERE products.productname = 'Mishi Kobe Niku'
Database: retail_world
Note: Speedy Express is a company; Sweden is a Shipcountry; calculation = DIVIDE(SUM(Shipcountry = 'Sweden'), SEM(Shipcountry)) * 100;
Question: What percentage does the shipment of products by Speedy Express to Sweden make up to the shipping company's total?
SQL: SELECT cast(count(CASE WHEN orders.shipcountry = 'Sweden' THEN 1 ELSE NULL END) AS REAL) * 100 / count(orders.orderid) FROM orders INNER JOIN shippers ON orders.shipvia = shippers.shipperid WHERE shippers.companyname = 'Speedy Express'
Database: retail_world
Note: region 1 refers to RegionID = 1;
Question: How many territory fall into region 1?
SQL: SELECT count(territoryid) FROM territories WHERE regionid = 1
Database: retail_world
Question: What are the the total number of territory in each region?
SQL: SELECT count(territorydescription) FROM territories WHERE regionid IN (1, 2, 3, 4) GROUP BY regionid
Database: retail_world
Note: from UK refers to country = 'UK';
Question: How many suppliers are from UK?
SQL: SELECT count(supplierid) FROM suppliers WHERE country = 'UK'
Database: retail_world
Note: Tokyo Traders refers to CompanyName = 'Tokyo Traders';
Question: Please give the contact name for Tokyo Traders.
SQL: SELECT contactname FROM suppliers WHERE companyname = 'Tokyo Traders'
Database: retail_world
Note: from USA refers to country = 'USA';
Question: How many employees from USA with Sales Representative title?
SQL: SELECT count(country) FROM employees WHERE country = 'USA' AND title = 'Sales Representative'
Database: retail_world
Note: highest salary refers to max(salary); position refers to Title;
Question: What are the highest salary earn by the the employee and what is his/her position in the company?
SQL: SELECT salary, title FROM employees WHERE salary = ( SELECT max(salary) FROM employees )
Database: retail_world
Note: Plutzer Lebensmittelgromrkte AG refers to CompanyName; is currently out of stock and on order refers to unitsInStock = 0 and unitsOnOrder > 0;
Question: How many products supplied by Plutzer Lebensmittelgromrkte AG that is currently out of stock and on order?
SQL: SELECT count(products.productid) FROM products INNER JOIN suppliers ON products.supplierid = suppliers.supplierid WHERE suppliers.companyname = 'Plutzer Lebensmittelgromrkte AG' AND products.unitsinstock = 0 AND products.unitsonorder = 0
Database: retail_world
Note: product refers to productid; highest unit price refers to Max(unitprice);
Question: What product have the highest unit price and how many quantity have been being sold?
SQL: SELECT products.productname, order details.quantity FROM products INNER JOIN `order details` ON products.productid = order details.productid ORDER BY products.unitprice DESC LIMIT 1
Database: retail_world
Note: least order refers to Min(orderid);
Question: Which employee has created the least order and please indicates the employee's title?
SQL: SELECT employees.title FROM employees INNER JOIN orders ON employees.employeeid = orders.employeeid GROUP BY employees.title ORDER BY count(orders.orderid) LIMIT 1
Database: retail_world
Note: most common product refers to max(count(productid)); customer from Germany refers to country = 'Germany';
Question: What is the most common product ordered by a customer from Germany?
SQL: SELECT order details.productid FROM customers INNER JOIN `order details` WHERE customers.country = 'Germany' GROUP BY order details.productid ORDER BY count(order details.productid) DESC LIMIT 1
Database: retail_world
Note: shipped to Brazil refers to Shipcountry = 'Brazil'; by Speedy Express Company refers to CompanyName = 'Speedy Express'; total products value refers to sum(MULTIPLY(unitprice, quantity));
Question: What are the total products value shipped to Brazil by Speedy Express Company?
SQL: SELECT sum(order details.quantity * order details.unitprice) FROM orders INNER JOIN `order details` ON orders.orderid = order details.orderid INNER JOIN shippers ON orders.shipvia = shippers.shipperid WHERE shippers.companyname = 'Speedy Express' AND orders.shipcountry = 'Brazil'
Database: retail_world
Note: subordinates of employee ID 2 refers to employeeid where ReportsTo = 2;  biggest order in terms of value refers to max(MULTIPLY(quantity, unitprice));
Question: How many subordinates does employee ID 2 have and what is the biggest order in terms of value that his/her subordinates have created?
SQL: SELECT count(employees.employeeid), sum(order details.quantity * order details.unitprice) FROM employees INNER JOIN orders ON employees.employeeid = orders.employeeid INNER JOIN `order details` ON orders.orderid = order details.orderid WHERE employees.reportsto = 2 ORDER BY sum(order details.unitprice * order details.quantity) DESC LIMIT 1
Database: retail_world
Note: sales representative refers to Title = 'Sales Representative'; sales values refers to MULTIPLY(quantity, unitprice); the highest sales refers to max(MULTIPLY(quantity, unitprice));
Question: How many sales values have been created by sales representative and which sales representative have the highest sales?
SQL: SELECT sum(order details.unitprice * order details.quantity) FROM employees INNER JOIN orders ON employees.employeeid = orders.employeeid INNER JOIN `order details` ON orders.orderid = order details.orderid WHERE employees.title = 'Sales Representative' ORDER BY sum(order details.unitprice * order details.quantity)
Database: retail_world
Note: is a UK citizen refers to country = 'UK';
Question: How many employees is a UK citizen and are they all covering the same region?
SQL: SELECT count(employees.employeeid), territories.regionid FROM employees INNER JOIN employeeterritories ON employees.employeeid = employeeterritories.employeeid INNER JOIN territories ON employeeterritories.territoryid = territories.territoryid WHERE employees.country = 'UK' GROUP BY territories.regionid
Database: retail_world
Note: biggest purchase refers to max(productid.Order_Details); ship to refers to Shipcountry;
Question: Which customer have the biggest purchase in one order and where does this order being ship to?
SQL: SELECT customers.companyname, orders.shipcountry FROM customers INNER JOIN orders ON customers.customerid = orders.customerid INNER JOIN `order details` ON orders.orderid = order details.orderid GROUP BY customers.companyname, orders.shipcountry ORDER BY count(order details.productid) DESC LIMIT 1