1sf/bird-sql-train-with-schema huggingface dataset:
Database: beer_factory
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
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
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
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
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
Question: How many sales ids are there for customer id 80?
SQL: SELECT COUNT(SalesID) FROM Sales WHERE CustomerID = 80
Database: sales
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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
Tables: Customers, Employees, Products, Sales
Columns (table index, column name): -1, *, 0, CustomerID, 0, FirstName, 0, MiddleInitial, 0, LastName, 1, EmployeeID, 1, FirstName, 1, MiddleInitial, 1, LastName, 2, ProductID, 2, Name, 2, Price, 3, SalesID, 3, SalesPersonID, 3, CustomerID, 3, ProductID, 3, Quantity
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