Chinastark/bird_dataset huggingface dataset:
Database: beer_factory
Question: How many root beers of the Bulldog were purchased in August, 2014?
Evidence: Bulldog refers to BrandName = 'Bulldog'; purchased in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';
SQL: SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014-08%' AND T3.BrandName = 'Bulldog'
Database: beer_factory
Question: Please list the full names of the customers who have purchased at least one root beer produced by AJ Stephans Beverages.
Evidence: full name = First, Last; customers who have purchased at least one root beer refers to CustomerID > = 1; produced by AJ Stephans Beverages refers to BreweryName = 'AJ Stephans Beverages';
SQL: SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T4.BreweryName = 'AJ Stephans Beverages'
Database: beer_factory
Question: Among the root beer brands that do not advertise on Twitter, how many of them have root beers sold in August, 2014?
Evidence: do not advertise on Twitter refers to twitter IS NULL; in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';
SQL: SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014-08%' AND T3.Twitter IS NULL
Database: beer_factory
Question: What is the number of the credit card that Frank-Paul Santangelo used to purchase root beers on 2014/7/7?
Evidence: number of the credit card refers to CreditCardNumber; on 2014/7/7 refers to TransactionDate = '2014-07-07';
SQL: SELECT DISTINCT T2.CreditCardNumber FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T2.TransactionDate = '2014-07-07'
Database: beer_factory
Question: Among all the root beers purchased by Frank-Paul Santangelo, how many of them were non-sweetened?
Evidence: non-sweetened refers to honey = 'FALSE' AND artificialsweetener = 'FALSE';
SQL: SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T4.ArtificialSweetener = 'FALSE' AND T4.Honey = 'FALSE'
Database: beer_factory
Question: Please list the dates on which a male customer has purchased more than 3 root beers.
Evidence: dates of purchase refers to TransactionDate; male customer refers to Gender = 'M'; purchased more than 3 root beers refers to COUNT(CustomerID) > 3;
SQL: SELECT T2.TransactionDate FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Gender = 'M' GROUP BY T2.TransactionDate HAVING COUNT(T2.CustomerID) > 3
Database: beer_factory
Question: What is the average number of root beers of the brand A&W sold in a day in August, 2014?
Evidence: average = DIVIDE(SUM(COUNT(RootBeerID WHERE BrandName = 'A&W' AND SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08')), 31); A&W refers to BrandName = 'A&W'; in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';
SQL: SELECT CAST(COUNT(T1.BrandID) AS REAL) / 31 FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014-08%' AND T3.BrandName = 'A&W'
Database: beer_factory
Question: Among all the root beers sold in 2014, what is the percentage of the root beers produced by the brewery AJ Stephans Beverages?
Evidence: sold in 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014'; percentage = DIVIDE(MULTIPLY(SUM(BreweryName = 'AJ Stephans Beverages'), 1.0), COUNT(RootBeerID)) WHERE SUBSTR(TransactionDate, 1, 4) = '2014'; AJ Stephans Beverages refers to BreweryName = 'AJ Stephans Beverages';
SQL: SELECT CAST(COUNT(CASE WHEN T3.BreweryName = 'AJ Stephans Beverages' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014%'
Database: beer_factory
Question: Tell the number of reviews given by James House.
Evidence: FALSE;
SQL: SELECT COUNT(T2.CustomerID) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'James' AND T1.Last = 'House'
Database: beer_factory
Question: Show the credit card number of Lisa Ling.
Evidence: FALSE;
SQL: SELECT DISTINCT T2.CreditCardNumber FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Lisa' AND T1.Last = 'Ling'
Database: beer_factory
Question: State the coordinate of Sac State American River Courtyard.
Evidence: coordinate = 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: beer_factory
Question: Provide the name of the location where transaction no.100885 happened.
Evidence: name of the location refers to LocationName; transaction no. refers to TransactionID; TransactionID = 100885;
SQL: SELECT T2.LocationName FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.TransactionID = 100885
Database: beer_factory
Question: Which city does the customer who finished transaction no.103545 live in?
Evidence: transaction no. refers to TransactionID; TransactionID = 103545;
SQL: SELECT T1.City FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.TransactionID = 103545
Database: beer_factory
Question: What is the phone number of the customer who owns the credit card of number 6011179359005380?
Evidence: FALSE;
SQL: SELECT DISTINCT T1.PhoneNumber FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.CreditCardNumber = 6011179359005382
Database: beer_factory
Question: Which customer has the most reviews? State the full name.
Evidence: customer that has the most reviews refers to MAX(COUNT(CustomerID)); full name = First, Last;
SQL: SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID GROUP BY T1.CustomerID ORDER BY COUNT(T2.CustomerID) DESC LIMIT 1
Database: beer_factory
Question: For the customer who leaves the review content of "Tastes like Australia.", when was his/her first purchase date?
Evidence: review content of "Tastes like Australia." refers to Review = 'Tastes like Australia.';
SQL: SELECT T1.FirstPurchaseDate FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Review = 'Tastes like Australia.'
Database: beer_factory
Question: When did Natalie Dorris buy her first root beer?
Evidence: when a customer bought their first root beer refers to FirstPurchaseDate;
SQL: SELECT T2.TransactionDate FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Natalie' AND T1.Last = 'Dorris' ORDER BY T2.TransactionDate LIMIT 1
Database: beer_factory
Question: For the root beer brand with the most 5 star ratings, what is the name of the brewery?
Evidence: most 5 star ratings refers to MAX(COUNT(StarRating = 5)); name of the brewery refers to BreweryName;
SQL: SELECT T1.BreweryName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 GROUP BY T1.BrandID ORDER BY COUNT(T2.StarRating) DESC LIMIT 1
Database: beer_factory
Question: For the customer who gave a 3 star rating to Frostie brand on 2014/4/24, did the user permit the company to send regular emails to him/her?
Evidence: 3 star rating refers to StarRating = 3; Frostie refers to  BrandName = 'Frostie'; if SubscribedToEmailList = 'TRUE', it means the user permit the company to send regular emails to him/her; if SubscribedToEmailList = FALSE', it means the user did not permit the company to send regular emails to him/her; rating on 2014/4/24 refers to ReviewDate = '2014-04-24';
SQL: SELECT CASE WHEN T1.SubscribedToEmailList LIKE 'TRUE' THEN 'YES' ELSE 'NO' END AS result 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 T2.StarRating = 3 AND T3.BrandName = 'Frostie' AND T2.ReviewDate = '2014-04-24'
Database: beer_factory
Question: For the root beer brand which got the review with the content of "The quintessential dessert root beer. No ice cream required.", what is the current retail price of the root beer?
Evidence: review with the content of "The quintessential dessert root beer. No ice cream required." refers to Review = 'The quintessential dessert root beer. No ice cream required.';
SQL: SELECT T1.CurrentRetailPrice - T1.WholesaleCost AS price FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.Review = 'The quintessential dessert root beer. No ice cream required.'
Database: beer_factory
Question: What is the percentage of 5 star ratings River City brand root beer get?
Evidence: percentage = MULTIPLY(DIVIDE(SUM(BrandID WHERE StarRating = 5), COUNT(BrandID) WHERE BrandName = 'River City'), 1.0); 5 star ratings refers to StarRating = 5; River City refers to BrandName = 'River City';
SQL: SELECT CAST(COUNT(CASE WHEN T2.StarRating = 5 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.StarRating) FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.BrandName = 'River City'
Database: beer_factory
Question: What is the average number of reviews of all the root beer brands from "CA" State?
Evidence: average = DIVIDE(COUNT(CustomerID), COUNT(BrandID) WHERE state = CA); 

SQL: SELECT CAST(COUNT(*) AS REAL) / COUNT(DISTINCT T1.BrandID) AS avgreview FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.State = 'CA'
Database: beer_factory
Question: How many female customers permit the company to send regular emails to them?
Evidence: female refers to Gender = 'F'; customer permits the company to send regular emails to them refers to SubscribedToEmailList = 'TRUE';
SQL: SELECT COUNT(CustomerID) FROM customers WHERE Gender = 'F' AND SubscribedToEmailList = 'TRUE'
Database: beer_factory
Question: What is the name of the brand of the beer with the shortest brewed history?
Evidence: name of the brand of the beer refers to BrandName; shortest brewed history refers to MAX(FirstBrewedYear);
SQL: SELECT BrandName FROM rootbeerbrand ORDER BY FirstBrewedYear DESC LIMIT 1
Database: beer_factory
Question: What are the full names of the first top 10 customers?
Evidence: full name = First Last; first top 10 customers refers to MIN(FirstPurchaseDate) LIMIT 10;
SQL: SELECT First, Last FROM customers ORDER BY FirstPurchaseDate LIMIT 10
Database: beer_factory
Question: How many breweries are there in Australia?
Evidence: Australia refers to Country = 'Australia';
SQL: SELECT COUNT(BreweryName) FROM rootbeerbrand WHERE Country = 'Australia'
Database: beer_factory
Question: How many customers are named Charles in Sacramento?
Evidence: Sacramento refers to City = 'Sacramento';
SQL: SELECT COUNT(CustomerID) FROM customers WHERE First = 'Charles' AND City = 'Sacramento'
Database: beer_factory
Question: How many transactions were paid through MasterCard in 2014?
Evidence: MasterCard refers to CreditCardType = 'MasterCard'; in 2014 refers to TransactionDate > = '2014-01-01' AND TransactionDate < = '2014-12-31';
SQL: SELECT COUNT(TransactionID) FROM `transaction` WHERE CreditCardType = 'MasterCard' AND TransactionDate LIKE '2014%'
Database: beer_factory
Question: Which brand of root beer did Jayne Collins give the lowest rating?
Evidence: brand of root beer refers to BrandName; lowest rating refers to MIN(StarRating);
SQL: SELECT T3.BrandName 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 = 'Jayne' AND T1.Last = 'Collins' AND T2.StarRating = 1
Database: beer_factory
Question: How many sweet bottled root beers that do not contain cane sugar were purchased in 2015 through the selling company located in Sac State American River Courtyard?
Evidence: sweet refers to Honey = 'TRUE'; bottled refers to ContainerType = 'Bottle'; do not contain cane sugar refers to CaneSugar = 'FALSE'; in 2015 refers to PurchaseDate < = '2015-12-31'; Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard';
SQL: SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN location AS T3 ON T1.LocationID = T3.LocationID WHERE T3.LocationName = 'Sac State American River Courtyard' AND T1.PurchaseDate LIKE '2015%' AND T2.Honey = 'TRUE' AND T2.CaneSugar = 'FALSE' AND T1.ContainerType = 'Bottle'
Database: beer_factory
Question: Which brewery does the most purchased root beer in 2016 belong to?
Evidence: most purchased root beer refers to MAX(COUNT(BrandID)); in 2016 refers to PurchaseDate > = '2016-01-01' AND PurchaseDate < = '2016-12-31';
SQL: SELECT T2.BreweryName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T1.PurchaseDate BETWEEN '2016-01-01' AND '2016-12-31' GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1
Database: beer_factory
Question: What are the full names of the customer who gave River City a 5-star?
Evidence: full name = First, Last; River City refers to BrandName = 'River City'; 5-star refers to StarRating = 5;
SQL: SELECT T1.First, T1.Last 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 T3.BrandName = 'River City' AND T2.StarRating = 5
Database: beer_factory
Question: How many root beers did Tom Hanks purchase between 2015 to 2016?
Evidence: between 2015 to 2016 refers to TransactionDate > = '2015-01-01' AND TransactionDate < '2016-12-31';
SQL: SELECT COUNT(T2.RootBeerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Tom' AND T1.Last = 'Hanks' AND T2.TransactionDate BETWEEN '2015-01-01' AND '2016-12-31'
Database: beer_factory
Question: Which brand of root beer was highly rated by customers?
Evidence: brand of root beer refers to BrandName; highly rated refers to MAX(COUNT(StarRating = 5));
SQL: SELECT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5
Database: beer_factory
Question: How many Henry Weinhard's were bought by Nicholas Sparks?
Evidence: Henry Weinhard's refers to BrandName = 'Henry Weinhard''s';
SQL: SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T1.First = 'Nicholas' AND T1.Last = 'Sparks' AND T4.BrandName LIKE 'Henry Weinhard%s'
Database: beer_factory
Question: Among the root beer brands that do not advertise on Facebook and Twitter, which brand has the highest number of purchases?
Evidence: do not advertise on Facebook and Twitter refers to FacebookPage IS NULL AND Twitter IS NULL; highest number of purchases refers to MAX(COUNT(BrandID));
SQL: SELECT T2.BreweryName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T2.FacebookPage IS NULL AND T2.Twitter IS NULL GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1
Database: beer_factory
Question: Between Sac State Union and Sac State American River Courtyard, which location sold the most Dog n Suds root beer?
Evidence: Between Sac State Union and Sac State American River Courtyard refers to LocationName IN('Sac State American River Courtyard', 'Sac State Union'); Dog n Suds refers to BrandName = 'Dog n Suds'; sold the most root beer refers to MAX(COUNT(BrandID));
SQL: SELECT T3.LocationName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN location AS T3 ON T1.LocationID = T3.LocationID WHERE T2.BrandName = 'Dog n Suds' AND T3.LocationName IN ('Sac State American River Courtyard', 'Sac State Union') GROUP BY T1.LocationID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1
Database: beer_factory
Question: How many canned A&W were purchased in 2016?
Evidence: canned refers to ContainerType = 'Can'; A&W refers to BrandName = 'A&W'; in 2016 refers to PurchaseDate > = '2016-01-01' AND PurchaseDate < = '2016-12-31';
SQL: SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T1.ContainerType = 'Can' AND T2.BrandName = 'A&W' AND T1.PurchaseDate LIKE '2016%'
Database: beer_factory
Question: What is the precise location of Sac State Union?
Evidence: precise location = Latitude, Longitude; Sac State Union refers to LocationName = 'Sac State Union';
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 Union'
Database: beer_factory
Question: What are the brands of the root beers that received 5-star ratings from no less than 5 customers?
Evidence: brand of the root beer refers to BrandName; 5-star ratings refers to StarRating = 5; no less than 5 customers refers to COUNT(CustomerID) > = 5;
SQL: SELECT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 GROUP BY T2.BrandID HAVING COUNT(T2.StarRating) >= 5
Database: beer_factory
Question: List the brands of root beer produced by Dr Pepper Snapple Group and calculate their percentage of purchases between 2014 to 2016.
Evidence: brand of root beer refers to BrandName; produced by Dr Pepper Snapple Group refers to BreweryName = 'Dr Pepper Snapple Group'; percentage of purchases = MULTIPLY(DIVIDE(SUM(BrandID WHERE PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2016-12-31'), COUNT(BrandID) WHERE BreweryName = 'Dr Pepper Snapple Group'), 1.0); between 2014 to 2016 refers to PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2016-12-31;
SQL: SELECT T1.BrandName , CAST(SUM(CASE WHEN T2.PurchaseDate >= '2014-01-01' AND T2.PurchaseDate <= '2016-12-31' THEN 1 ELSE 0 END) AS REAL) / COUNT(T2.BrandID) AS purchase FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID WHERE T1.BreweryName = 'Dr Pepper Snapple Group' GROUP BY T2.BrandID
Database: beer_factory
Question: Which brand of root beer has the lowest unit profit available to wholesalers? Indicate the ID of the customer that has the highest number of purchases of the said brand.
Evidence: brand of root beer refers to BrandName; lowest unit profit available to wholesalers refers to MIN(SUBTRACT(CurrentRetailPrice, WholesaleCost)); ID of the customer refers to CustomerID; highest number of purchases refers to MAX(COUNT(CustomerID));
SQL: SELECT T3.BrandName, T2.CustomerID FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID GROUP BY T3.BrandID ORDER BY T3.CurrentRetailPrice - T3.WholesaleCost, COUNT(T1.BrandID) DESC LIMIT 1
Database: beer_factory
Question: List the full name and phone number of male customers from Fair Oaks who are subscribed to the email list.
Evidence: full name = First, Last; male customers refers to Gender = 'M'; Fair Oaks refers to City = 'Fair Oaks'; subscribed to the email list refers to SubscribedToEmailList = 'TRUE';
SQL: SELECT First, Last, PhoneNumber FROM customers WHERE Gender = 'M' AND City = 'Fair Oaks' AND SubscribedToEmailList = 'TRUE'
Database: beer_factory
Question: Among the root beer purchased in 2014, what percentage were sold in cans?
Evidence: in 2014 refers to PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2014-12-31'; percentage = MULTIPLY(DIVIDE(SUM(ContainerType = 'Can'), COUNT(RootBeerID) WHERE PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2014-12-31'), 1.0); in cans refers to ContainerType = 'Can';
SQL: SELECT CAST(COUNT(CASE WHEN ContainerType = 'Can' THEN RootBeerID ELSE NULL END) AS REAL) * 100 / COUNT(RootBeerID) FROM rootbeer WHERE PurchaseDate LIKE '2014%'
Database: beer_factory
Question: Give the name of the brands that brewed their first drink between 1996 and 2000 in the descending order of the date brewed.
Evidence: name of the brands refers to BrandName; between 1996 and 2000 refers to FirstBrewedYear > = 1996 AND FirstBrewedYear < = 2000;
SQL: SELECT BrandName FROM rootbeerbrand WHERE FirstBrewedYear BETWEEN '1996' AND '2000' ORDER BY FirstBrewedYear DESC
Database: beer_factory
Question: Find the brand Id of the root beer which has the most number of customers who gave 1-star ratings.
Evidence: most number of customers who gave 1-star ratings refers to MAX(COUNT(StarRating = 1)); 1-star ratings refers to StarRating = 1;
SQL: SELECT BrandID FROM rootbeerreview WHERE StarRating = 1 GROUP BY BrandID ORDER BY COUNT(BrandID) DESC LIMIT 1
Database: beer_factory
Question: Among the transactions, what percentage is done by using a visa card?
Evidence: visa card refers to CreditCardType = 'Visa'; percentage = MULTIPLY(DIVIDE(SUM(CreditCardType = 'Visa'), COUNT(TransactionID)), 1.0);
SQL: SELECT CAST(COUNT(CASE WHEN CreditCardType = 'Visa' THEN TransactionID ELSE NULL END) AS REAL) * 100 / COUNT(TransactionID) FROM `transaction`
Database: beer_factory
Question: How many brands of root beers are available in cans and contain corn syrup and artificial sweeteners?
Evidence: available in cans refers to AvailableInCans = 'TRUE'; contain corn syrup refers to CornSyrup = 'TRUE'; contain artificial sweeteners refers to ArtificialSweetener = 'TRUE';
SQL: SELECT COUNT(BrandID) FROM rootbeerbrand WHERE CornSyrup = 'TRUE' AND ArtificialSweetener = 'TRUE' AND AvailableInCans = 'TRUE'
Database: beer_factory
Question: Calculate the percentage of sales done at Sac State American River Courtyard.
Evidence: percentage =   MULTIPLY(DIVIDE(SUM(LocationName = 'Sac State American River Courtyard'), COUNT(LocationID)), 1.0); Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard';
SQL: SELECT CAST(COUNT(CASE WHEN T2.LocationName = 'Sac State American River Courtyard' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID
Database: beer_factory
Question: On average how many caffeinated root beers are sold a day?
Evidence: average = DIVIDE(COUNT(RootBeerID WHERE Caffeinated = 'TRUE'), COUNT(PurchaseDate)); caffeinated refers to Caffeinated = 'TRUE';
SQL: SELECT CAST(COUNT(T2.RootBeerID) AS REAL) / COUNT(DISTINCT T2.PurchaseDate) 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.Caffeinated = 'TRUE'
Database: beer_factory
Question: Find the root beer with the most and least amount of profit per unit and list the container types in which these root beers are sold.
Evidence: most amount of profit per unit refers to MAX(SUBTRACT(CurrentRetailPrice, WholesaleCost)); least amount of profit per unit refers to MIN(SUBTRACT(CurrentRetailPrice, WholesaleCost));
SQL: SELECT * FROM ( SELECT T1.BrandName, T2.ContainerType FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID ORDER BY T1.CurrentRetailPrice - T1.WholesaleCost DESC LIMIT 1 ) UNION ALL SELECT * FROM ( SELECT T3.BrandName, T4.ContainerType FROM rootbeerbrand AS T3 INNER JOIN rootbeer AS T4 ON T3.BrandID = T4.BrandID ORDER BY T3.CurrentRetailPrice - T3.WholesaleCost ASC LIMIT 1 )