Chinastark/bird_dataset huggingface dataset:
Database: beer_factory
Note: 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';
Question: Please list the full names of the customers who have purchased at least one root beer produced by AJ Stephans Beverages.
SQL: SELECT customers.first, customers.last FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid INNER JOIN rootbeer ON transaction.rootbeerid = rootbeer.rootbeerid INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE rootbeerbrand.breweryname = 'AJ Stephans Beverages'
Database: beer_factory
Note: 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';
Question: Among the root beer brands that do not advertise on Twitter, how many of them have root beers sold in August, 2014?
SQL: SELECT count(rootbeer.brandid) FROM rootbeer INNER JOIN `transaction` ON rootbeer.rootbeerid = transaction.rootbeerid INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE transaction.transactiondate LIKE '2014-08%' AND rootbeerbrand.twitter IS NULL
Database: beer_factory
Note: number of the credit card refers to creditcardnumber; on 2014/7/7 refers to transactiondate = '2014-07-07';
Question: What is the number of the credit card that Frank-Paul Santangelo used to purchase root beers on 2014/7/7?
SQL: SELECT DISTINCT transaction.creditcardnumber FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid WHERE customers.first = 'Frank-Paul' AND customers.last = 'Santangelo' AND transaction.transactiondate = '2014-07-07'
Database: beer_factory
Note: non-sweetened refers to honey = 'FALSE' AND artificialsweetener = 'FALSE';
Question: Among all the root beers purchased by Frank-Paul Santangelo, how many of them were non-sweetened?
SQL: SELECT count(customers.customerid) FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid INNER JOIN rootbeer ON transaction.rootbeerid = rootbeer.rootbeerid INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE customers.first = 'Frank-Paul' AND customers.last = 'Santangelo' AND rootbeerbrand.artificialsweetener = 'FALSE' AND rootbeerbrand.honey = 'FALSE'
Database: beer_factory
Note: dates of purchase refers to transactiondate; male customer refers to gender = 'M'; purchased more than 3 root beers refers to COUNT(customerid) > 3;
Question: Please list the dates on which a male customer has purchased more than 3 root beers.
SQL: SELECT transaction.transactiondate FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid WHERE customers.gender = 'M' GROUP BY transaction.transactiondate HAVING count(transaction.customerid) > 3
Database: beer_factory
Note: 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';
Question: What is the average number of root beers of the brand A&W sold in a day in August, 2014?
SQL: SELECT cast(count(rootbeer.brandid) AS REAL) / 31 FROM rootbeer INNER JOIN `transaction` ON rootbeer.rootbeerid = transaction.rootbeerid INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE transaction.transactiondate LIKE '2014-08%' AND rootbeerbrand.brandname = 'A&W'
Database: beer_factory
Note: 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';
Question: Among all the root beers sold in 2014, what is the percentage of the root beers produced by the brewery AJ Stephans Beverages?
SQL: SELECT cast(count(CASE WHEN rootbeerbrand.breweryname = 'AJ Stephans Beverages' THEN 1 ELSE NULL END) AS REAL) * 100 / count(rootbeer.brandid) FROM rootbeer INNER JOIN `transaction` ON rootbeer.rootbeerid = transaction.rootbeerid INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE transaction.transactiondate LIKE '2014%'
Database: beer_factory
Note: FALSE;
Question: Tell the number of reviews given by James House.
SQL: SELECT count(rootbeerreview.customerid) FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid WHERE customers.first = 'James' AND customers.last = 'House'
Database: beer_factory
Note: FALSE;
Question: Show the credit card number of Lisa Ling.
SQL: SELECT DISTINCT transaction.creditcardnumber FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid WHERE customers.first = 'Lisa' AND customers.last = 'Ling'
Database: beer_factory
Note: coordinate = latitude, longitude; Sac state American River Courtyard refers to locationname = 'Sac state American River Courtyard';
Question: State the coordinate of Sac State American River Courtyard.
SQL: SELECT geolocation.latitude, geolocation.longitude FROM LOCATION INNER JOIN geolocation ON LOCATION.locationid = geolocation.locationid WHERE LOCATION.locationname = 'Sac State American River Courtyard'
Database: beer_factory
Note: name of the location refers to locationname; transaction no. refers to transactionid; transactionid = 100885;
Question: Provide the name of the location where transaction no.100885 happened.
SQL: SELECT LOCATION.locationname FROM `transaction` INNER JOIN LOCATION ON transaction.locationid = LOCATION.locationid WHERE transaction.transactionid = 100885
Database: beer_factory
Note: transaction no. refers to transactionid; transactionid = 103545;
Question: Which city does the customer who finished transaction no.103545 live in?
SQL: SELECT customers.city FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid WHERE transaction.transactionid = 103545
Database: beer_factory
Note: FALSE;
Question: What is the phone number of the customer who owns the credit card of number 6011179359005380?
SQL: SELECT DISTINCT customers.phonenumber FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid WHERE transaction.creditcardnumber = 6011179359005382
Database: beer_factory
Note: customer that has the most reviews refers to MAX(COUNT(customerid)); full name = first, last;
Question: Which customer has the most reviews? State the full name.
SQL: SELECT customers.first, customers.last FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid GROUP BY customers.customerid ORDER BY count(rootbeerreview.customerid) DESC LIMIT 1
Database: beer_factory
Note: review content of "Tastes like Australia." refers to review = 'Tastes like Australia.';
Question: For the customer who leaves the review content of "Tastes like Australia.", when was his/her first purchase date?
SQL: SELECT customers.firstpurchasedate FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid WHERE rootbeerreview.review = 'Tastes like Australia.'
Database: beer_factory
Note: when a customer bought their first root beer refers to firstpurchasedate;
Question: When did Natalie Dorris buy her first root beer?
SQL: SELECT transaction.transactiondate FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid WHERE customers.first = 'Natalie' AND customers.last = 'Dorris' ORDER BY transaction.transactiondate LIMIT 1
Database: beer_factory
Note: most 5 star ratings refers to MAX(COUNT(starrating = 5)); name of the brewery refers to breweryname;
Question: For the root beer brand with the most 5 star ratings, what is the name of the brewery?
SQL: SELECT rootbeerbrand.breweryname FROM rootbeerbrand INNER JOIN rootbeerreview ON rootbeerbrand.brandid = rootbeerreview.brandid WHERE rootbeerreview.starrating = 5 GROUP BY rootbeerbrand.brandid ORDER BY count(rootbeerreview.starrating) DESC LIMIT 1
Database: beer_factory
Note: 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';
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?
SQL: SELECT CASE WHEN customers.subscribedtoemaillist LIKE 'TRUE' THEN 'YES' ELSE 'NO' END AS RESULT FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid INNER JOIN rootbeerbrand ON rootbeerreview.brandid = rootbeerbrand.brandid WHERE rootbeerreview.starrating = 3 AND rootbeerbrand.brandname = 'Frostie' AND rootbeerreview.reviewdate = '2014-04-24'
Database: beer_factory
Note: 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.';
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?
SQL: SELECT rootbeerbrand.currentretailprice - rootbeerbrand.wholesalecost AS price FROM rootbeerbrand INNER JOIN rootbeerreview ON rootbeerbrand.brandid = rootbeerreview.brandid WHERE rootbeerreview.review = 'The quintessential dessert root beer. No ice cream required.'
Database: beer_factory
Note: 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';
Question: What is the percentage of 5 star ratings River City brand root beer get?
SQL: SELECT cast(count(CASE WHEN rootbeerreview.starrating = 5 THEN 1 ELSE NULL END) AS REAL) * 100 / count(rootbeerreview.starrating) FROM rootbeerbrand INNER JOIN rootbeerreview ON rootbeerbrand.brandid = rootbeerreview.brandid WHERE rootbeerbrand.brandname = 'River City'
Database: beer_factory
Note: average = DIVIDE(COUNT(customerid), COUNT(brandid) WHERE state = CA);
Question: What is the average number of reviews of all the root beer brands from "CA" State?
SQL: SELECT cast(count(*) AS REAL) / count(DISTINCT rootbeerbrand.brandid) AS avgreview FROM rootbeerbrand INNER JOIN rootbeerreview ON rootbeerbrand.brandid = rootbeerreview.brandid WHERE rootbeerbrand.state = 'CA'
Database: beer_factory
Note: female refers to gender = 'F'; customer permits the company to send regular emails to them refers to subscribedtoemaillist = 'TRUE';
Question: How many female customers permit the company to send regular emails to them?
SQL: SELECT count(customerid) FROM customers WHERE gender = 'F' AND subscribedtoemaillist = 'TRUE'
Database: beer_factory
Note: name of the brand of the beer refers to brandname; shortest brewed history refers to MAX(firstbrewedyear);
Question: What is the name of the brand of the beer with the shortest brewed history?
SQL: SELECT brandname FROM rootbeerbrand ORDER BY firstbrewedyear DESC LIMIT 1
Database: beer_factory
Note: full name = first last; first top 10 customers refers to MIN(firstpurchasedate) LIMIT 10;
Question: What are the full names of the first top 10 customers?
SQL: SELECT FIRST, LAST FROM customers ORDER BY firstpurchasedate LIMIT 10
Database: beer_factory
Note: Australia refers to country = 'Australia';
Question: How many breweries are there in Australia?
SQL: SELECT count(breweryname) FROM rootbeerbrand WHERE country = 'Australia'
Database: beer_factory
Note: Sacramento refers to city = 'Sacramento';
Question: How many customers are named Charles in Sacramento?
SQL: SELECT count(customerid) FROM customers WHERE FIRST = 'Charles' AND city = 'Sacramento'
Database: beer_factory
Note: MasterCard refers to creditcardtype = 'MasterCard'; in 2014 refers to transactiondate >= '2014-01-01' AND transactiondate <= '2014-12-31';
Question: How many transactions were paid through MasterCard in 2014?
SQL: SELECT count(transactionid) FROM `transaction` WHERE creditcardtype = 'MasterCard' AND transactiondate LIKE '2014%'
Database: beer_factory
Note: brand of root beer refers to brandname; lowest rating refers to MIN(starrating);
Question: Which brand of root beer did Jayne Collins give the lowest rating?
SQL: SELECT rootbeerbrand.brandname FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid INNER JOIN rootbeerbrand ON rootbeerreview.brandid = rootbeerbrand.brandid WHERE customers.first = 'Jayne' AND customers.last = 'Collins' AND rootbeerreview.starrating = 1
Database: beer_factory
Note: 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';
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?
SQL: SELECT count(rootbeer.brandid) FROM rootbeer INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid INNER JOIN LOCATION ON rootbeer.locationid = LOCATION.locationid WHERE LOCATION.locationname = 'Sac State American River Courtyard' AND rootbeer.purchasedate LIKE '2015%' AND rootbeerbrand.honey = 'TRUE' AND rootbeerbrand.canesugar = 'FALSE' AND rootbeer.containertype = 'Bottle'
Database: beer_factory
Note: most purchased root beer refers to MAX(COUNT(brandid)); in 2016 refers to purchasedate >= '2016-01-01' AND purchasedate <= '2016-12-31';
Question: Which brewery does the most purchased root beer in 2016 belong to?
SQL: SELECT rootbeerbrand.breweryname FROM rootbeer INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE rootbeer.purchasedate BETWEEN '2016-01-01' AND '2016-12-31' GROUP BY rootbeerbrand.brandid ORDER BY count(rootbeer.brandid) DESC LIMIT 1
Database: beer_factory
Note: full name = first, last; River city refers to brandname = 'River city'; 5-star refers to starrating = 5;
Question: What are the full names of the customer who gave River City a 5-star?
SQL: SELECT customers.first, customers.last FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid INNER JOIN rootbeerbrand ON rootbeerreview.brandid = rootbeerbrand.brandid WHERE rootbeerbrand.brandname = 'River City' AND rootbeerreview.starrating = 5
Database: beer_factory
Note: between 2015 to 2016 refers to transactiondate >= '2015-01-01' AND transactiondate < '2016-12-31';
Question: How many root beers did Tom Hanks purchase between 2015 to 2016?
SQL: SELECT count(transaction.rootbeerid) FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid WHERE customers.first = 'Tom' AND customers.last = 'Hanks' AND transaction.transactiondate BETWEEN '2015-01-01' AND '2016-12-31'
Database: beer_factory
Note: brand of root beer refers to brandname; highly rated refers to MAX(COUNT(starrating = 5));
Question: Which brand of root beer was highly rated by customers?
SQL: SELECT rootbeerbrand.brandname FROM rootbeerbrand INNER JOIN rootbeerreview ON rootbeerbrand.brandid = rootbeerreview.brandid WHERE rootbeerreview.starrating = 5
Database: beer_factory
Note: Henry Weinhard's refers to brandname = 'Henry Weinhard''s';
Question: How many Henry Weinhard's were bought by Nicholas Sparks?
SQL: SELECT count(customers.customerid) FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid INNER JOIN rootbeer ON transaction.rootbeerid = rootbeer.rootbeerid INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE customers.first = 'Nicholas' AND customers.last = 'Sparks' AND rootbeerbrand.brandname LIKE 'Henry Weinhard%s'
Database: beer_factory
Note: 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));
Question: Among the root beer brands that do not advertise on Facebook and Twitter, which brand has the highest number of purchases?
SQL: SELECT rootbeerbrand.breweryname FROM rootbeer INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE rootbeerbrand.facebookpage IS NULL AND rootbeerbrand.twitter IS NULL GROUP BY rootbeerbrand.brandid ORDER BY count(rootbeer.brandid) DESC LIMIT 1
Database: beer_factory
Note: 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));
Question: Between Sac State Union and Sac State American River Courtyard, which location sold the most Dog n Suds root beer?
SQL: SELECT LOCATION.locationname FROM rootbeer INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid INNER JOIN LOCATION ON rootbeer.locationid = LOCATION.locationid WHERE rootbeerbrand.brandname = 'Dog n Suds' AND LOCATION.locationname IN ('Sac State American River Courtyard', 'Sac State Union') GROUP BY rootbeer.locationid ORDER BY count(rootbeer.brandid) DESC LIMIT 1
Database: beer_factory
Note: 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';
Question: How many canned A&W were purchased in 2016?
SQL: SELECT count(rootbeer.brandid) FROM rootbeer INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE rootbeer.containertype = 'Can' AND rootbeerbrand.brandname = 'A&W' AND rootbeer.purchasedate LIKE '2016%'
Database: beer_factory
Note: precise location = latitude, longitude; Sac state Union refers to locationname = 'Sac state Union';
Question: What is the precise location of Sac State Union?
SQL: SELECT geolocation.latitude, geolocation.longitude FROM LOCATION INNER JOIN geolocation ON LOCATION.locationid = geolocation.locationid WHERE LOCATION.locationname = 'Sac State Union'
Database: beer_factory
Note: 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;
Question: What are the brands of the root beers that received 5-star ratings from no less than 5 customers?
SQL: SELECT rootbeerbrand.brandname FROM rootbeerbrand INNER JOIN rootbeerreview ON rootbeerbrand.brandid = rootbeerreview.brandid WHERE rootbeerreview.starrating = 5 GROUP BY rootbeerreview.brandid HAVING count(rootbeerreview.starrating) >= 5
Database: beer_factory
Note: 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;
Question: List the brands of root beer produced by Dr Pepper Snapple Group and calculate their percentage of purchases between 2014 to 2016.
SQL: SELECT rootbeerbrand.brandname , cast(sum(CASE WHEN rootbeer.purchasedate >= '2014-01-01' AND rootbeer.purchasedate <= '2016-12-31' THEN 1 ELSE 0 END) AS REAL) / count(rootbeer.brandid) AS purchase FROM rootbeerbrand INNER JOIN rootbeer ON rootbeerbrand.brandid = rootbeer.brandid WHERE rootbeerbrand.breweryname = 'Dr Pepper Snapple Group' GROUP BY rootbeer.brandid
Database: beer_factory
Note: 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));
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.
SQL: SELECT rootbeerbrand.brandname, transaction.customerid FROM rootbeer INNER JOIN `transaction` ON rootbeer.rootbeerid = transaction.rootbeerid INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid GROUP BY rootbeerbrand.brandid ORDER BY rootbeerbrand.currentretailprice - rootbeerbrand.wholesalecost, count(rootbeer.brandid) DESC LIMIT 1
Database: beer_factory
Note: 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';
Question: List the full name and phone number of male customers from Fair Oaks who are subscribed to the email list.
SQL: SELECT FIRST, LAST, phonenumber FROM customers WHERE gender = 'M' AND city = 'Fair Oaks' AND subscribedtoemaillist = 'TRUE'
Database: beer_factory
Note: 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';
Question: Among the root beer purchased in 2014, what percentage were sold in cans?
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
Note: name of the brands refers to brandname; between 1996 and 2000 refers to firstbrewedyear >= 1996 AND firstbrewedyear <= 2000;
Question: Give the name of the brands that brewed their first drink between 1996 and 2000 in the descending order of the date brewed.
SQL: SELECT brandname FROM rootbeerbrand WHERE firstbrewedyear BETWEEN '1996' AND '2000' ORDER BY firstbrewedyear DESC
Database: beer_factory
Note: most number of customers who gave 1-star ratings refers to MAX(COUNT(starrating = 1)); 1-star ratings refers to starrating = 1;
Question: Find the brand Id of the root beer which has the most number of customers who gave 1-star ratings.
SQL: SELECT brandid FROM rootbeerreview WHERE starrating = 1 GROUP BY brandid ORDER BY count(brandid) DESC LIMIT 1
Database: beer_factory
Note: visa card refers to creditcardtype = 'Visa'; percentage = MULTIPLY(DIVIDE(SUM(creditcardtype = 'Visa'), COUNT(transactionid)), 1.0);
Question: Among the transactions, what percentage is done by using a visa card?
SQL: SELECT cast(count(CASE WHEN creditcardtype = 'Visa' THEN transactionid ELSE NULL END) AS REAL) * 100 / count(transactionid) FROM `transaction`
Database: beer_factory
Note: available in cans refers to availableincans = 'TRUE'; contain corn syrup refers to cornsyrup = 'TRUE'; contain artificial sweeteners refers to artificialsweetener = 'TRUE';
Question: How many brands of root beers are available in cans and contain corn syrup and artificial sweeteners?
SQL: SELECT count(brandid) FROM rootbeerbrand WHERE cornsyrup = 'TRUE' AND artificialsweetener = 'TRUE' AND availableincans = 'TRUE'
Database: beer_factory
Note: 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';
Question: Calculate the percentage of sales done at Sac State American River Courtyard.
SQL: SELECT cast(count(CASE WHEN LOCATION.locationname = 'Sac State American River Courtyard' THEN 1 ELSE NULL END) AS REAL) * 100 / count(transaction.transactionid) FROM `transaction` INNER JOIN LOCATION ON transaction.locationid = LOCATION.locationid