Chinastark/bird_dataset huggingface dataset:
Database: beer_factory
Question: List out the name of the top 10 spenders and what credit card type are they using.
Evidence: top 10 spenders refers to MAX(PurchasePrice) LIMIT 10;
SQL: SELECT T1.First, T1.Last, T2.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID GROUP BY T1.CustomerID ORDER BY SUM(T2.PurchasePrice) DESC LIMIT 10
Database: beer_factory
Question: List out root beer brand that is not caffeinated and not containing cane sugar. What is the total amount sold for this products?
Evidence: root beer brand refers to BrandName; not caffeinated refers to Caffeinated = 'FALSE'; not containing cane sugar refers to CaneSugar = 'FALSE'; total amount sold = SUM(PurchasePrice);
SQL: SELECT T1.BrandName, SUM(T3.PurchasePrice) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.CaneSugar = 'FALSE' AND T1.Caffeinated = 'FALSE' GROUP BY T1.BrandName
Database: beer_factory
Question: Which of the root beer brand have the lowest purchase?
Evidence: root beer brand refers to BrandName; lowest purchase refers to MIN(COUNT(BrandID));
SQL: SELECT T2.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) LIMIT 1
Database: beer_factory
Question: What is the best seller root beer brand and what is the average star rating for this root beer?
Evidence: best seller root beer refers to MAX(COUNT(BrandID)); average star rating = AVG(StarRating);
SQL: SELECT T1.BrandID, AVG(T1.StarRating) FROM rootbeerreview AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID GROUP BY T3.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1
Database: beer_factory
Question: What is the percentage difference of River City sale compare to Frostie?
Evidence: percentage difference = (DIVIDE(MULTIPLY(SUBTRACT(SUM(PurchasePrice WHERE BrandName = 'River City'), SUM(PurchasePrice WHERE BrandName = 'Frostie')), 100), SUM(PurchasePrice WHERE BrandName = 'Frostie'))); River City refers to BrandName = 'River City'; Frostie refers to BrandName = 'Frostie';
SQL: SELECT CAST((SUM(CASE WHEN T3.BrandName = 'River City' THEN T2.PurchasePrice ELSE 0 END) - SUM(CASE WHEN T3.BrandName = 'Frostie' THEN T2.PurchasePrice ELSE 0 END)) AS REAL) * 100 / SUM(CASE WHEN T3.BrandName = 'Frostie' THEN T2.PurchasePrice ELSE 0 END) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID
Database: beer_factory
Question: Please name all of the cities in California.
Evidence: California refers to State = 'CA';
SQL: SELECT DISTINCT City FROM customers WHERE State = 'CA'
Database: beer_factory
Question: What is the percentage of female customers who subscribed to the email list?
Evidence: percentage = MULTIPLY(DIVIDE(COUNT(CustomerID WHERE Gender = 'F'), COUNT(CustomerID) WHERE SubscribedToEmailList = 'TRUE'), 1.0); female refers to Gender = 'F'; subscribed to the email list refers to SubscribedToEmailList = 'TRUE';
SQL: SELECT CAST(COUNT(CASE WHEN Gender = 'F' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(SubscribedToEmailList) FROM customers WHERE SubscribedToEmailList = 'TRUE'
Database: beer_factory
Question: Which type of card did Dick Ruthven use to pay for all of his transactions?
Evidence: type of card refers to CreditCardType;
SQL: SELECT DISTINCT T2.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Dick' AND T1.Last = 'Ruthven'
Database: beer_factory
Question: How many transactions were made at Sac State Union?
Evidence: Sac State Union refers to LocationName = 'Sac State Union';
SQL: SELECT COUNT(T1.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State Union'
Database: beer_factory
Question: How many stars did Urijah Faber rate for Frostie?
Evidence: stars refers to StarRating; Frostie refers to BrandName = 'Frostie';
SQL: SELECT T2.StarRating FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T2.BrandID = T3.BrandID WHERE T1.First = 'Urijah' AND T1.Last = 'Faber' AND T3.BrandName = 'Frostie'
Database: beer_factory
Question: Which brand has the lowest star rating with a "Too spicy!" review?
Evidence: lowest star rating refers to MIN(StarRating); "Too spicy!" review refers to Review = 'Too Spicy!';
SQL: SELECT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T2.BrandID = T1.BrandID WHERE T2.StarRating = 1 AND T2.Review = 'Too Spicy!'
Database: beer_factory
Question: How many purchases were made at Sac State American River Courtyard using Master Card?
Evidence: Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard'; Master Card refers to CreditCardType = 'MasterCard';
SQL: SELECT COUNT(T1.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State American River Courtyard' AND T1.CreditCardType = 'MasterCard'
Database: beer_factory
Question: Which brand in 2012 has the lowest star rating and contains cane sugar as well as honey?
Evidence: brand refers to BrandName; in 2012 refers to ReviewDate LIKE '2012%'; lowest star rating refers to MIN(StarRating); contains cane sugar as well as honey refers to CaneSugar = 'TRUE' AND Honey = 'TRUE';
SQL: SELECT DISTINCT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.CaneSugar = 'TRUE' AND T1.Honey = 'TRUE' AND T2.StarRating = 1 AND T2.ReviewDate LIKE '2012%'
Database: beer_factory
Question: What is the precise location of the place where Tommy Kono made a purchase in 2014?
Evidence: precise location = Latitude, Longitude; in 2014 refers to TransactionDate LIKE '2014%';
SQL: SELECT DISTINCT T1.Latitude, T1.Longitude FROM geolocation AS T1 INNER JOIN `transaction` AS T2 ON T2.LocationID = T1.LocationID INNER JOIN customers AS T3 ON T3.CustomerID = T2.CustomerID WHERE T3.First = 'Tommy' AND T3.Last = 'Kono' AND T2.TransactionDate LIKE '2014%'
Database: beer_factory
Question: What is the email address of the customer who made a purchase in transaction 100016?
Evidence: email address refers to Email; transaction 100016 refers to TransactionID = 100016;
SQL: SELECT T1.Email FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.TransactionID = '100016'
Database: beer_factory
Question: How many transactions were made to purchase a bottle of beer using American Express?
Evidence: bottle of beer refers to ContainerType = 'Bottle'; American Express refers to CreditCardType = 'American Express';
SQL: SELECT COUNT(T1.RootBeerID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID WHERE T1.ContainerType = 'Bottle' AND T2.CreditCardType = 'American Express'
Database: beer_factory
Question: Which location sold more bottles of beer?
Evidence: location refers to LocationName; bottle of beer refers to ContainerType = 'Bottle'; location that sold more bottles of beer refers to MAX(COUNT(LocationID WHERE ContainerType = 'Bottle'));
SQL: SELECT T2.LocationName FROM rootbeer AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ContainerType = 'Bottle' GROUP BY T2.LocationID ORDER BY COUNT(T1.LocationID) DESC LIMIT 1
Database: beer_factory
Question: Please name any three root beer brands that have the highest market evaluation and acceptance.
Evidence: root beer brands refers to BrandName; highest market evaluation and acceptance refers to MAX(COUNT(StarRating = 5));
SQL: SELECT DISTINCT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 LIMIT 3
Database: beer_factory
Question: What is the precise location of the Sac State American River Courtyard?
Evidence: precise location = Latitude, Longitude; Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard';
SQL: SELECT T2.Latitude, T2.Longitude FROM location AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.LocationName = 'Sac State American River Courtyard'
Database: sales
Question: How many sales ids are there for customer id 80?
SQL: SELECT COUNT(SalesID) FROM Sales WHERE CustomerID = 80
Database: sales
Question: Count the total quantity for sales from id 1 to 10.
Evidence: sales from id 1 to 10 refers to SalesID BETWEEN 1 AND 10;
SQL: SELECT SUM(Quantity) FROM Sales WHERE SalesID BETWEEN 1 AND 10
Database: sales
Question: Calculate the average quantity per sales from sales id 20 to 30.
Evidence: average quantity = AVG(Quantity); SalesID BETWEEN 20 AND 30;
SQL: SELECT AVG(Quantity) FROM Sales WHERE SalesID BETWEEN 20 AND 30
Database: sales
Question: List down the product id for products with the highest quantity.
Evidence: highest quantity refers to MAX(Quantity);
SQL: SELECT DISTINCT ProductID FROM Sales WHERE Quantity = ( SELECT MAX(Quantity) FROM Sales )
Database: sales
Question: How many product ids have the lowest price?
Evidence: lowest price refers to MIN(Price);
SQL: SELECT COUNT(DISTINCT ProductID) FROM Products WHERE Price = ( SELECT MAX(Price) FROM Products )
Database: sales
Question: List down product names of free gifts.
Evidence: free gifts refers to Price = 0;
SQL: SELECT Name FROM Products WHERE Price = 0
Database: sales
Question: List down the product name for products from id 1 to 10.
Evidence: products from id 1 to 10 refers to ProductID BETWEEN 1 AND 10;
SQL: SELECT Name FROM Products WHERE ProductID BETWEEN 1 AND 10
Database: sales
Question: What is the name of the product with the lowest quantity?
Evidence: lowest quantity refers to MIN(Quantity);
SQL: SELECT T2.Name FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID ORDER BY T1.Quantity LIMIT 1
Database: sales
Question: How many customer ids have purchased Hex Nut 9?
Evidence: Hex Nut 9' is name of product;
SQL: SELECT COUNT(T1.CustomerID) FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 9'
Database: sales
Question: Calculate the total sales ids that were sales of Flat Washer 8.
Evidence: Flat Washer 8' is name of product;
SQL: SELECT COUNT(T1.SalesID) FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Flat Washer 8'
Database: sales
Question: List down all of the product names that were placed by sales person with id 10.
Evidence: id refers to SalesPersonID; SalesPersonID = 10
SQL: SELECT DISTINCT T1.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.SalesPersonID = 10
Database: sales
Question: List down the first name of customers who placed order for product id 1.
SQL: SELECT T1.FirstName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T2.ProductID = 1
Database: sales
Question: What is the last name of the customer who placed an order for sales id 178?
SQL: SELECT T1.LastName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.SalesID = 178
Database: sales
Question: List down product ids that were purchased by customers called Abby.
SQL: SELECT DISTINCT T1.ProductID FROM Sales AS T1 INNER JOIN Customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.FirstName = 'Abby'
Database: sales
Question: Write down all of the product ids that were placed by Meander.
SQL: SELECT DISTINCT T2.ProductID FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID WHERE T1.FirstName = 'Meander'
Database: sales
Question: What is the last name of sales person for sales id 100?
SQL: SELECT T1.LastName FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID WHERE T2.SalesID = 100
Database: sales
Question: What is the first name of employee who handled sales for customer called Abigail?
SQL: SELECT DISTINCT T3.FirstName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID WHERE T1.FirstName = 'Abigail'
Database: sales
Question: How many free gifts have customer with id 11782 received?
Evidence: free gifts refers to Price = 0;
SQL: SELECT COUNT(T1.ProductID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.CustomerID = 11782 AND T1.Price = 0
Database: sales
Question: What is the full name of customers who dealt with sales person with id 5?
Evidence: full name = FirstName, MiddleInitial, LastName;
SQL: SELECT T1.FirstName, T1.MiddleInitial, T1.LastName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.SalesPersonID = 5
Database: sales
Question: List down all of the sales IDs for sales handled by sales people with first name starting with alphabet "s".
Evidence: first name starting with alphabet "s" refers to FirstName LIKE 's%';
SQL: SELECT T1.SalesID FROM Sales AS T1 INNER JOIN Employees AS T2 ON T1.SalesPersonID = T2.EmployeeID WHERE SUBSTR(T2.FirstName, 1, 1) = 's'
Database: sales
Question: Among customers with IDs from 1 to 100, what is the highest price of products they purchased?
Evidence: IDs from 1 to 100 refers to CustomerID BETWEEN 1 AND 100 ; highest price refers to MAX(Price);
SQL: SELECT T1.Price FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.CustomerID BETWEEN 1 AND 100 ORDER BY T1.Price DESC LIMIT 1
Database: sales
Question: Among customers with the last name of Valdez, who purchased the highest quantity?
Evidence: highest quantity refers to MAX(Quantity);
SQL: SELECT T1.FirstName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.LastName = 'Valdez' ORDER BY T2.Quantity DESC LIMIT 1
Database: sales
Question: Sum up the number sales ids handled by employees called Morningstar, Heather and Dean.
Evidence: SUM = ADD(SUM(SalesID WHERE FirstName = 'Morningstar'), SUM(SalesID WHERE FirstName = 'Heather'), SUM(SalesID WHERE FirstName = 'Dean'));
SQL: SELECT SUM(IIF(T2.FirstName = 'Morningstar', 1, 0)) + SUM(IIF(T2.FirstName = 'Heather', 1, 0)) + SUM(IIF(T2.FirstName = 'Dean', 1, 0)) AS num FROM Sales AS T1 INNER JOIN Employees AS T2 ON T1.SalesPersonID = T2.EmployeeID
Database: sales
Question: Has Alex purchased product with id 498?
Evidence: WHEN ProductID = 498 AND FirstName = 'Alex' means that Alex purchased a product; WHEN ProductID = 498 AND FirstName NOT 'Alex' means Alex has not purchased a product;
SQL: SELECT IIF(T1.ProductID = 498, 'YES', 'NO') FROM Sales AS T1 INNER JOIN Customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.FirstName = 'Alex'
Database: sales
Question: Calculate the total price of products purchased by Adam.
Evidence: total price = SUM(MULTIPLY(Price, Quantity));
SQL: SELECT SUM(T3.Price * T2.quantity) FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T1.FirstName = 'Adam'
Database: sales
Question: Calculate the total price for products from id 400 to 500.
Evidence: total price = SUM(MULTIPLY(Price, Quantity)); from id 400 to 500 refers to ProductID BETWEEN 400 AND 500;
SQL: SELECT SUM(T1.Price * T2.quantity) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.ProductID BETWEEN 400 AND 500
Database: sales
Question: Calculate the total quantity of products with name starting with alphabet "c".
Evidence: name starting with alphabet "c" refers to Name LIKE 'C%';
SQL: SELECT SUM(T2.Quantity) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE SUBSTR(T1.Name, 1, 1) = 'C'
Database: sales
Question: Calculate the total quantity of products purchased by customer called Adrian.
SQL: SELECT SUM(T2.Quantity) FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.FirstName = 'Adam'
Database: sales
Question: List the product ID of the top five products, by descending order, in terms of price.
Evidence: top 5 products in terms of Price refers to MAX(Price) LIMIT 5;
SQL: SELECT ProductID FROM Products ORDER BY Price DESC LIMIT 5
Database: sales
Question: Among the products, how many of them are freebies?
Evidence: freebies refers to Price = 0;
SQL: SELECT COUNT(ProductID) FROM Products WHERE Price = 0
Database: sales
Question: Write down the name of products whose sale quantity is more than 950.
Evidence: quantity is more than 950 refers to Quantity > 950;
SQL: SELECT DISTINCT T1.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 950
Database: sales
Question: What is the full name of employee who sold 1000 units?
Evidence: full name of employee = FirstName, MiddleInitial, LastName; units refers to quantity; Quantity = 100
SQL: SELECT DISTINCT T2.FirstName, T2.MiddleInitial, T2.LastName FROM Sales AS T1 INNER JOIN Employees AS T2 ON T1.SalesPersonID = T2.EmployeeID WHERE T1.Quantity = 1000
Database: sales
Question: Tally the product name and quantity of the first ten sales.
Evidence: first ten sales refers to SalesID BETWEEN 1 AND 10;
SQL: SELECT T3.Name, T2.Quantity FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T2.SalesID BETWEEN 1 AND 10
Database: sales
Question: What is the total sales amount for Reflector?
Evidence: total sales amount = SUM(MULTIPLY(Price, Quantity)); 'Reflector' is name of product;
SQL: SELECT SUM(T1.Price * T2.quantity) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Reflector'
Database: sales
Question: What is the best selling colour for HL Mountain Frame, 42?
Evidence: best selling colour refers to name of product with higher total sales; SUM(SalesID WHERE Name = 'HL Mountain Frame - Silver, 42') > SUM(Name = 'HL Mountain Frame - Black, 42') means Silver is the best selling colour, otherwise Black is the best seling colour;
SQL: SELECT IIF(SUM(IIF(T1.Name = 'HL Mountain Frame - Silver, 42', T2.SalesID, 0)) - SUM(IIF(T1.Name = 'HL Mountain Frame - Black, 42', T2.SalesID, 0)) > 0, 'Silver', 'Black') FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID
Database: sales
Question: What is the difference in price between HL Mountain Frame - Black, 42 and LL Mountain Frame - Black, 42?
Evidence: difference = SUBTRACT((Price WHERE Name = 'HL Mountain Frame - Black, 42'), (Price WHERE Name = 'HL Mountain Frame - Black, 42'));
SQL: SELECT ( SELECT Price FROM Products WHERE Name = 'HL Mountain Frame - Black, 42' ) - ( SELECT Price FROM Products WHERE Name = 'LL Mountain Frame - Black, 42' ) AS num
Database: sales
Question: Calculate the total number of sales closed by Michel E. DeFrance?
SQL: SELECT COUNT(T1.SalesID) FROM Sales AS T1 INNER JOIN Employees AS T2 ON T1.SalesPersonID = T2.EmployeeID WHERE T2.FirstName = 'Michel' AND T2.MiddleInitial = 'e' AND T2.LastName = 'DeFrance'
Database: sales
Question: What is the average number of customers per sales person?
Evidence: average = DIVIDE(COUNT(CustomerID), COUNT(EmployeeID));
SQL: SELECT CAST(COUNT(T1.CustomerID) AS REAL) / COUNT(T3.EmployeeID) FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID
Database: sales
Question: Among all customers handled by Innes E. del Castillo, how many have purchased Short-Sleeve Classic Jersey, L?
Evidence: Short-Sleeve Classic Jersey, L' is name of product;
SQL: SELECT COUNT(T2.CustomerID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID WHERE T3.FirstName = 'Innes' AND T3.LastName = 'del Castillo' AND T1.Name = 'Short-Sleeve Classic Jersey, L' AND T3.MiddleInitial = 'e'
Database: sales
Question: Name the sales person who helped Elizabeth A. White to purchase Road-250 Black, 48.
Evidence: name of the sales person = FirstName, MiddleInitial, LastName; 'Road-250 Black, 48' is name of product;
SQL: SELECT DISTINCT T3.FirstName, T3.MiddleInitial, T3.LastName FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID INNER JOIN Customers AS T4 ON T2.CustomerID = T4.CustomerID WHERE T4.MiddleInitial = 'A' AND T4.LastName = 'White' AND T1.Name = 'Road-250 Black, 48' AND T4.FirstName = 'Elizabeth'
Database: sales
Question: How many sales people managed to sell Headlights - Weatherproof?
Evidence: Headlights - Weatherproof' is name of product
SQL: SELECT COUNT(T2.SalesPersonID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Headlights - Weatherproof'
Database: sales
Question: Calculate the revenue produced through sales of HL Road Frame - Red, 56.
Evidence: revenue = MULTIPLY(SUM(Quantity, Price)); 'HL Road Frame - Red, 56' is name of product;
SQL: SELECT SUM(T2.Quantity * T1.Price) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'HL Road Frame - Red, 56'
Database: sales
Question: How many sales transactions were given by the customer named Joe L. Lopez?
Evidence: sales transactions refers to SalesID;
SQL: SELECT COUNT(T1.SalesID) FROM Sales AS T1 INNER JOIN Customers AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.FirstName = 'Joe' AND T2.MiddleInitial = 'L' AND T2.LastName = 'Lopez'
Database: sales
Question: Name the customers who received 'Touring Rim' as a free gift.
Evidence: name of the customer = FirstName, MiddleInitial, LastName; 'Touring Rim' is name of product;
SQL: SELECT DISTINCT T1.FirstName, T1.MiddleInitial, T1.LastName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN Products AS T3 ON T2.ProductID = T3.ProductID WHERE T3.Name = 'Touring Rim' AND T3.Price = 0
Database: sales
Question: Find the number of customers handled by each of the sales people.
SQL: SELECT COUNT(CustomerID) FROM Sales GROUP BY SalesPersonID
Database: sales
Question: How many sales people are handling all the customers?
SQL: SELECT COUNT(EmployeeID) FROM Employees
Database: sales
Question: Identify the name of the sales person with employee ID 7.
Evidence: name of the sales person = FirstName, MiddleInitial, LastName;
SQL: SELECT FirstName, MiddleInitial, LastName FROM Employees WHERE EmployeeID = 7
Database: sales
Question: Name the most expensive and the least expensive products available, excluding free gifts.
Evidence: most expensive product refers to MAX(Price); least expensive product refers to MIN(Price); excluding free gifts refers to not including Price = 0;
SQL: SELECT Name FROM Products WHERE Price IN (( SELECT MAX(Price) FROM Products ), ( SELECT MIN(Price) FROM Products ))
Database: sales
Question: Among all the customers who have purchased ML Bottom Bracket, identify the percentage of sales by Albert I. Ringer?
Evidence: ML Bottom Bracket' is name of product; percentage = MULTIPLY(DIVIDE(SUM(CustomerID WHERE FirstName = 'Albert' AND MiddleInitial = 'I' AND LastName = 'Ringer'), COUNT(CustomerID)), 1.0);
SQL: SELECT CAST(SUM(IIF(T3.FirstName = 'Albert' AND T3.MiddleInitial = 'I' AND T3.LastName = 'Ringer', 1, 0)) AS REAL) * 100 / COUNT(T2.CustomerID) FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID INNER JOIN Employees AS T3 ON T2.SalesPersonID = T3.EmployeeID WHERE T1.Name = 'ML Bottom Bracket'
Database: sales
Question: How many customers have the first name Abigail?
SQL: SELECT COUNT(CustomerID) FROM Customers WHERE FirstName = 'Abigail'
Database: sales
Question: Indicate the quantity of Blade products sold.
Evidence: Blade' is name of product;
SQL: SELECT DISTINCT T2.Quantity FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T1.Name = 'Blade'
Database: sales
Question: Give the full name of the employee who has sold the most quantity.
Evidence: full name of the employee = FirstName, LastName; most quantity refers to MAX(Quantity);
SQL: SELECT T1.FirstName, T1.LastName FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID ORDER BY T2.Quantity DESC LIMIT 1