Chinastark/bird_dataset huggingface dataset:
Database: beer_factory
Note: average = DIVIDE(COUNT(rootbeerid WHERE caffeinated = 'TRUE'), COUNT(purchasedate)); caffeinated refers to caffeinated = 'TRUE';
Question: On average how many caffeinated root beers are sold a day?
SQL: SELECT cast(count(rootbeer.rootbeerid) AS REAL) / count(DISTINCT rootbeer.purchasedate) FROM rootbeerbrand INNER JOIN rootbeer ON rootbeerbrand.brandid = rootbeer.brandid INNER JOIN `transaction` ON rootbeer.rootbeerid = transaction.rootbeerid WHERE rootbeerbrand.caffeinated = 'TRUE'
Database: beer_factory
Note: most amount of profit per unit refers to MAX(SUBTRACT(currentretailprice, wholesalecost)); least amount of profit per unit refers to MIN(SUBTRACT(currentretailprice, wholesalecost));
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.
SQL: SELECT * FROM ( SELECT rootbeerbrand.brandname, rootbeer.containertype FROM rootbeerbrand INNER JOIN rootbeer ON rootbeerbrand.brandid = rootbeer.brandid ORDER BY rootbeerbrand.currentretailprice - rootbeerbrand.wholesalecost DESC LIMIT 1 ) UNION ALL SELECT * FROM ( SELECT rootbeerbrand.brandname, rootbeer.containertype FROM rootbeerbrand INNER JOIN rootbeer ON rootbeerbrand.brandid = rootbeer.brandid ORDER BY rootbeerbrand.currentretailprice - rootbeerbrand.wholesalecost ASC LIMIT 1 )
Database: beer_factory
Note: average cost = DIVIDE(SUM(purchaseprice > 2), COUNT(rootbeerid) WHERE purchaseprice > 2); more than 2 dollars refers to purchaseprice > 2; in bottles refers to containertype = 'Bottle';
Question: What is the average cost of root beers purchased for more than 2 dollars and sold in bottles?
SQL: SELECT avg(transaction.purchaseprice) FROM rootbeer INNER JOIN `transaction` ON rootbeer.rootbeerid = transaction.rootbeerid INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE rootbeer.containertype = 'Bottle' AND transaction.purchaseprice > 2
Database: beer_factory
Note: in bottles refers to containertype = 'Bottle';  location 38.559615, -121.42243 refers to latitude = 38.559615 AND longitude = -121.42243;
Question: Among the root beers sold in bottles, how many are sold at the location 38.559615, -121.42243?
SQL: SELECT count(rootbeer.brandid) FROM `transaction` INNER JOIN geolocation ON transaction.locationid = geolocation.locationid INNER JOIN LOCATION ON transaction.locationid = LOCATION.locationid INNER JOIN rootbeer ON transaction.rootbeerid = rootbeer.rootbeerid WHERE geolocation.latitude = 38.559615 AND geolocation.longitude = -121.42243 AND rootbeer.containertype = 'Bottle'
Database: beer_factory
Note: not subscribed to the mailing list refers to subscribedtoemaillist = 'FALSE'; percentage = MULTIPLY(DIVIDE(SUM(customerid WHERE starrating > 3), COUNT(customerid) WHERE subscribedtoemaillist = 'FALSE'), 1.0);
Question: Among the customers not subscribed to the mailing list, what percentage has given three or more stars in a review?
SQL: SELECT cast(count(CASE WHEN rootbeerreview.starrating > 3 THEN 1 ELSE NULL END) AS REAL) * 100 / count(rootbeerreview.customerid) FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid WHERE customers.subscribedtoemaillist = 'FALSE'
Database: beer_factory
Note: most five stars refers to MAX(COUNT(starrating = 5)); in 2012 refers to firstbrewedyear = 2012;
Question: Which root beer got the most five stars in 2012? Give the brand name of this beer.
SQL: SELECT rootbeerbrand.brandname FROM rootbeer INNER JOIN rootbeerreview ON rootbeer.brandid = rootbeerreview.brandid INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE rootbeerreview.starrating = 5 AND strftime('%Y', rootbeerreview.reviewdate) = '2012' GROUP BY rootbeer.brandid ORDER BY count(rootbeerreview.brandid) DESC LIMIT 1
Database: beer_factory
Note: female refers to gender = 'F'; contains artificial sweetener refers to artificialsweetener = 'TRUE';
Question: In the female customers, how many bought root beer that contains artificial sweetener?
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.gender = 'F' AND rootbeerbrand.artificialsweetener = 'TRUE'
Database: beer_factory
Note: difference = SUBTRACT(SUM(canesugar = 'TRUE'), SUM(cornsyrup = 'TRUE')); use cane sugar refers to canesugar = 'TRUE'; corn syrup refers to cornsyrup = 'TRUE';
Question: Calculate the difference between the number of root beers sold that use cane sugar and corn syrup.
SQL: SELECT count(CASE WHEN rootbeerbrand.canesugar = 'TRUE' THEN rootbeer.brandid ELSE NULL END) - count(CASE WHEN rootbeerbrand.cornsyrup = 'TRUE' THEN rootbeer.brandid ELSE NULL END) AS difference FROM rootbeer INNER JOIN `transaction` ON rootbeer.rootbeerid = transaction.rootbeerid INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid
Database: beer_factory
Note: brewery refers to breweryname; most sold root beer refers to MAX(COUNT(brandid)); in 2015 refers to transactiondate >= '2015-01-01' AND transactiondate <= '2015-12-31';
Question: Which brewery brewed the most sold root beer in 2015?
SQL: SELECT rootbeerbrand.breweryname FROM rootbeer INNER JOIN `transaction` ON rootbeer.rootbeerid = transaction.rootbeerid INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE transaction.transactiondate LIKE '2015%' GROUP BY rootbeerbrand.brandid ORDER BY count(rootbeer.brandid) DESC LIMIT 1
Database: beer_factory
Note: male customers refers to gender = 'M'; Sacramento refers to city = 'Sacramento'; percentage = MULTIPLY(DIVIDE(SUM(brandid WHERE brandname = 'Dominion'), COUNT(brandid) WHERE city = 'Sacramento'), 1.0); Dominion refers to brandname = 'Dominion'; in 2013 refers to transactiondate >= 2013-01-01 AND transactiondate < 2014-01-01;
Question: Among the male customers in Sacramento, what percentage bought Dominion root beer in 2013?
SQL: SELECT cast(count(CASE WHEN rootbeerbrand.brandname = 'Dominion' THEN customers.customerid ELSE NULL END) AS REAL) * 100 / 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.city = 'Sacramento' AND customers.gender = 'M' AND transaction.transactiondate LIKE '2014%'
Database: beer_factory
Note: difference in the average = SUBTRACT(DIVIDE(MULTIPLY(SUM(honey = 'TRUE'), 1.0), COUNT(transactiondate)), DIVIDE(MULTIPLY(SUM(honey = 'FALSE'), 1.0), COUNT(transactiondate))); contain honey refers to honey = 'TRUE'; don’t contain honey refers to honey = 'FALSE';
Question: What is the difference in the average number of sales per day of root beer brands that contain honey and that don’t contain honey.
SQL: SELECT (cast(sum(CASE WHEN rootbeerbrand.honey = 'TRUE' THEN 1 ELSE 0 END) AS REAL) / count(DISTINCT transaction.transactiondate)) - (cast(sum(CASE WHEN rootbeerbrand.honey <> 'TRUE' THEN 1 ELSE 0 END) AS REAL) / count(DISTINCT transaction.transactiondate)) FROM rootbeerbrand INNER JOIN rootbeer ON rootbeerbrand.brandid = rootbeer.brandid INNER JOIN `transaction` ON rootbeer.rootbeerid = transaction.rootbeerid
Database: beer_factory
Note: full name = first, last; American Express cards refers to creditcardtype = 'American Express'; Sac state Union refers to locationname = 'Sac state Union';
Question: Find and list the full name and email of the customers who used American Express cards in Sac State Union.
SQL: SELECT DISTINCT customers.first, customers.last, customers.email FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid INNER JOIN LOCATION ON transaction.locationid = LOCATION.locationid WHERE LOCATION.locationname = 'Sac State Union' AND transaction.creditcardtype = 'American Express'
Database: beer_factory
Note: September 2014 refers to reviewdate LIKE '2014-09%'; brand of beers refers to brandname; highest star ratings refers to MAX(starrating);
Question: In the reviews of September 2014. Which brand of beers obtained the highest star ratings?
SQL: SELECT DISTINCT rootbeerbrand.brandname FROM rootbeerbrand INNER JOIN rootbeerreview ON rootbeerbrand.brandid = rootbeerreview.brandid WHERE rootbeerreview.starrating = 5 AND rootbeerreview.reviewdate BETWEEN '2014-09-01' AND '2014-09-30'
Database: beer_factory
Note: precise location refers to latitude, longitude; American Express refers to creditcardtype = 'American Express';
Question: What is the precise location of all paying customers with American Express?
SQL: SELECT DISTINCT geolocation.latitude, geolocation.longitude FROM `transaction` INNER JOIN geolocation ON transaction.locationid = geolocation.locationid WHERE transaction.creditcardtype = 'American Express'
Database: beer_factory
Note: Folsom refers to city = 'Folsom'; Visa refers to creditcardtype = 'Visa';
Question: How many Folsom customers prefer to pay with Visa?
SQL: SELECT count(customers.customerid) FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid WHERE customers.city = 'Folsom' AND transaction.creditcardtype = 'Visa'
Database: beer_factory
Note: 5 stars refers to starrating = 5; in November 2012 refers to reviewdate LIKE '2012-11%';
Question: From which cities are the customers who gave 5 stars in their reviews in November 2012?
SQL: SELECT DISTINCT customers.city FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid WHERE rootbeerreview.starrating = 5 AND rootbeerreview.reviewdate BETWEEN '2012-11-01' AND '2012-11-30'
Database: beer_factory
Note: brands of beer refers to brandname;
Question: What brands of beer has Peg Winchester consumed?
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 = 'Peg' AND customers.last = 'Winchester'
Database: beer_factory
Note: brand of beer refers to brandname; worst rated most times refers to MAX(COUNT(starrating = 1));
Question: What brand of beer has been the worst rated most times?
SQL: SELECT rootbeerbrand.brandname FROM rootbeerbrand INNER JOIN rootbeerreview ON rootbeerreview.brandid = rootbeerbrand.brandid WHERE rootbeerreview.starrating = 1 GROUP BY rootbeerbrand.brandname ORDER BY count(rootbeerbrand.brandname) DESC LIMIT 1
Database: beer_factory
Note: credit card that is the most used refers to MAX(COUNT(creditcardtype)); non-alcoholic beer refers to alcoholic = 'FALSE';
Question: What credit card is the most used in the purchase of non-alcoholic beer?
SQL: SELECT transaction.creditcardtype FROM rootbeer INNER JOIN `transaction` ON rootbeer.rootbeerid = transaction.rootbeerid INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE rootbeerbrand.alcoholic = 'FALSE' GROUP BY transaction.creditcardtype ORDER BY count(transaction.creditcardtype) DESC LIMIT 1
Database: beer_factory
Note: name of the customer = first, last; 5-star review refers to starrating = 5;
Question: What is the name of all the customers who have ever given a 5-star review?
SQL: SELECT customers.first, customers.last FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid WHERE rootbeerreview.starrating = 5
Database: beer_factory
Note: Thomas Kemper refers to brandname = 'Thomas Kemper';  latitude the beer is consumed the most refers to MAX(COUNT(latitude));
Question: At what latitude is the Thomas Kemper brand beer consumed the most?
SQL: SELECT geolocation.latitude FROM rootbeer INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid INNER JOIN geolocation ON rootbeer.locationid = geolocation.locationid WHERE rootbeerbrand.brandname = 'Thomas Kemper' GROUP BY geolocation.latitude ORDER BY count(rootbeer.brandid) DESC LIMIT 1
Database: beer_factory
Note: most common refers to MAX(COUNT(starrating)); containing corn syrup refers to cornsyrup = 'TRUE';
Question: What star rating is the most common for beers containing corn syrup?
SQL: SELECT rootbeerreview.starrating FROM rootbeerbrand INNER JOIN rootbeerreview ON rootbeerbrand.brandid = rootbeerreview.brandid WHERE rootbeerbrand.cornsyrup = 'TRUE' GROUP BY rootbeerreview.starrating ORDER BY count(rootbeerreview.starrating) DESC LIMIT 1
Database: beer_factory
Note: precise location = latitude, longitude;
Question: What is the precise location of zip code 95819?
SQL: SELECT geolocation.latitude, geolocation.longitude FROM LOCATION INNER JOIN geolocation ON LOCATION.locationid = geolocation.locationid WHERE LOCATION.zipcode = 95819
Database: beer_factory
Note: coordinates 38,566,129, -121,426,432 refers to latitude = 38.566129 AND longitude = -121.426432;
Question: What brands of beers are manufactured at coordinates 38,566,129, -121,426,432?
SQL: SELECT DISTINCT rootbeerbrand.brandname FROM rootbeer INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid INNER JOIN geolocation ON rootbeer.locationid = geolocation.locationid WHERE geolocation.latitude = '38.566129' AND geolocation.longitude = '-121.426432'
Database: beer_factory
Note: average unit profit = DIVIDE(SUM(SUBTRACT(currentretailprice, wholesalecost)), COUNT(containertype = 'Can')); canned beers refers to containertype = 'Can';
Question: What is the average unit profit for wholesalers of canned beers?
SQL: SELECT avg(rootbeerbrand.currentretailprice - rootbeerbrand.wholesalecost) FROM rootbeer INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE rootbeer.containertype = 'Can'
Database: beer_factory
Note: percentage = MULTIPLY(DIVIDE(COUNT(customerid WHERE starrating = 3), COUNT(customerid) WHERE creditcardtype = 'Discover'), 100); Discover Credit Card refers to creditcardtype = 'Discover'; 3-star rating refers to starrating = 3;
Question: What percentage of customers who paid with a Discover Credit Card gave a 3-star rating?
SQL: SELECT cast(count(CASE WHEN rootbeerreview.starrating = 3 THEN 1 ELSE NULL END) AS REAL) * 100 / count(rootbeerreview.customerid) FROM rootbeerreview INNER JOIN `transaction` ON rootbeerreview.customerid = transaction.customerid WHERE transaction.creditcardtype = 'Discover'
Database: beer_factory
Note: star rating is more than 3 refers to starrating > 3;
Question: List the brand IDs of the beers whose star rating is more than 3.
SQL: SELECT brandid FROM rootbeerreview WHERE starrating > 3
Database: beer_factory
Note: bottle root beer refers to containertype = 'Bottle'; purchased between 4/3/2015 and 10/26/2015 refers to purchasedate BETWEEN '2015-04-23' AND '2015-10-26';
Question: How many brands of bottle root beer were purchased between 4/3/2015 and 10/26/2015?
SQL: SELECT count(brandid) FROM rootbeer WHERE containertype = 'Bottle' AND purchasedate BETWEEN '2015-04-03' AND '2015-10-26'
Database: beer_factory
Note: full name = first, last; 5-star rating refers to starrating = 5; commented "The quintessential dessert root beer. No ice cream required" refers to review = 'The quintessential dessert root beer. No ice cream required.';
Question: What is the full name of the customer who gave a 5-star rating and commented "The quintessential dessert root beer. No ice cream required" on his review?
SQL: SELECT customers.first, customers.last FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid WHERE rootbeerreview.starrating = 5 AND rootbeerreview.review = 'The quintessential dessert root beer. No ice cream required.'
Database: beer_factory
Note: email addresses refers to email; Sacramento refers to city = 'Sacramento'; star rating of more than 3 refers to starrating > 3; in 2014 refers to reviewdate LIKE '2014%';
Question: Tally the email addresses and phone numbers of customers from Sacramento who gave a star rating of more than 3 in 2014.
SQL: SELECT DISTINCT customers.email, customers.phonenumber FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid WHERE rootbeerreview.starrating > 3 AND customers.city = 'Sacramento' AND rootbeerreview.reviewdate BETWEEN '2014-01-01' AND '2014-12-31'
Database: beer_factory
Note: female refers to gender = 'F'; mailing list subscribers refers to subscribedtoemaillist = 'TRUE'; Elk Grove refers to city = 'Sacramento'; 4-star rating refers to starrating = 4; between 1/3/2016 and 10/26/2016 refers to reviewdate BETWEEN '2016-01-03' AND '2016-10-26';
Question: How many female mailing list subscribers from Sacramento gave a 4-star rating between 1/3/2016 and 10/26/2016?
SQL: SELECT count(customers.customerid) FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid WHERE rootbeerreview.starrating = 4 AND customers.city = 'Sacramento' AND customers.gender = 'F' AND customers.subscribedtoemaillist = 'TRUE' AND rootbeerreview.reviewdate BETWEEN '2013-01-03' AND '2013-10-26'
Database: beer_factory
Note: canned root beer refers to containertype = 'Can'; purchased before 6/6/2015 refers to purchasedate < '2015-06-06';
Question: Give me the brewery and brand names of canned root beer that were purchased before 6/6/2015.
SQL: SELECT DISTINCT rootbeerbrand.breweryname, rootbeerbrand.brandname FROM rootbeer INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE rootbeer.purchasedate < '2015-06-06' AND rootbeer.containertype = 'Can'
Database: beer_factory
Note: bottled root beer refers to containertype = 'Bottle'; first brewing year is no later than 1930 refers to firstbrewedyear < 1930;
Question: List the brand names of bottled root beer whose first brewing year is no later than 1930.
SQL: SELECT rootbeerbrand.brandname FROM rootbeer INNER JOIN rootbeerbrand ON rootbeer.brandid = rootbeerbrand.brandid WHERE rootbeerbrand.firstbrewedyear < '1930-01-01' AND rootbeer.containertype = 'Bottle' ORDER BY rootbeerbrand.firstbrewedyear LIMIT 1
Database: beer_factory
Note: Mastercard refers to creditcardtype = 'MasterCard'; between 12/25/2014 and 5/20/2016 refers to transactiondate BETWEEN '2014-12-25' AND '2016-05-20';
Question: How many times did Anna Himes use her Mastercard when paying between 12/25/2014 and 5/20/2016 ?
SQL: SELECT count(transaction.customerid) FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid WHERE customers.first = 'Anna' AND customers.last = 'Himes' AND transaction.creditcardtype = 'MasterCard' AND transaction.transactiondate BETWEEN '2014-12-25' AND '2016-05-20'
Database: beer_factory
Note: average star rating = AVG(starrating); female customers refers to gender = 'F; from 1/25/2015 to 3/10/2015 refers to reviewdate BETWEEN '2015-01-25' AND '2015-03-10';
Question: What is the average star rating given by female customers to brand ID 10018 from 1/25/2015 to 3/10/2015?
SQL: SELECT avg(rootbeerreview.starrating) FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid WHERE rootbeerreview.brandid = 10018 AND customers.gender = 'F' AND rootbeerreview.reviewdate BETWEEN '2013-01-25' AND '2015-03-10'
Database: beer_factory
Note: 1-star rating refers to starrating = 1; saying, "Yuk, more like licorice soda" refers to review = 'Yuk, more like licorice soda.';
Question: What is the brand name of the root beer that gained a 1-star rating from customer ID 331115 while saying, "Yuk, more like licorice soda"?
SQL: SELECT rootbeerbrand.brandname FROM rootbeerbrand INNER JOIN rootbeerreview ON rootbeerbrand.brandid = rootbeerreview.brandid WHERE rootbeerreview.customerid = 331115 AND rootbeerreview.review = 'Yuk, more like licorice soda.' AND rootbeerreview.starrating = 1
Database: beer_factory
Note: total purchases = SUM(purchaseprice); Visa credit card refers to creditcardtype = 'Visa'; Sac state American River Courtyard refers to locationname = 'Sac state American River Courtyard'; between 6/3/2014 and 11/27/2015 refers to transactiondate BETWEEN '2014-06-03' AND '2015-11-27';
Question: Calculate the total purchases made by customers using their Visa credit cards in the Sac State American River Courtyard between 6/3/2014 and 11/27/2015.
SQL: SELECT sum(transaction.purchaseprice) FROM `transaction` INNER JOIN LOCATION ON transaction.locationid = LOCATION.locationid WHERE LOCATION.locationname = 'Sac State American River Courtyard' AND transaction.creditcardtype = 'Visa' AND transaction.transactiondate BETWEEN '2014-06-03' AND '2015-11-27'
Database: beer_factory
Note: Sac state Union refers to locationname = 'Sac state Union'; American Express credit card refers to creditcardtype = 'American Express'; in 2014 refers to transactiondate LIKE '2014%';
Question: How many transactions were made in Sac State Union using the American Express credit card in 2014?
SQL: SELECT count(transaction.transactionid) FROM `transaction` INNER JOIN LOCATION ON transaction.locationid = LOCATION.locationid WHERE LOCATION.locationname = 'Sac State Union' AND transaction.creditcardtype = 'American Express' AND transaction.transactiondate BETWEEN '2014-01-01' AND '2014-12-31'
Database: beer_factory
Note: precise coordinate = latitude, longitude; Sac state Union refers to locationname = 'Sac state Union';
Question: What is the precise coordinate 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: Bulldog refers to brandname = 'Bulldog'; on 7/26/2013 refers to reviewdate = '2013-07-26';
Question: What did the customer say in his or her review of Bulldog root beer on 7/26/2013?
SQL: SELECT rootbeerreview.review FROM rootbeerbrand INNER JOIN rootbeerreview ON rootbeerbrand.brandid = rootbeerreview.brandid WHERE rootbeerbrand.brandname = 'Bulldog' AND rootbeerreview.reviewdate = '2013-07-26'
Database: beer_factory
Note: 5-star rating refers to starrating = 5; in 2013 refers to reviewdate LIKE '2013%'; unit profit available to wholesalers = SUBTRACT(currentretailprice, wholesalecost);
Question: List down the brand names of root beer that gained a 5-star rating from a customer's review in 2013. Calculate the unit profit available to wholesalers for each brand.
SQL: SELECT rootbeerbrand.brandname, rootbeerbrand.currentretailprice - rootbeerbrand.wholesalecost AS RESULT FROM rootbeerbrand INNER JOIN rootbeerreview ON rootbeerbrand.brandid = rootbeerreview.brandid WHERE rootbeerreview.starrating = 5 AND rootbeerreview.reviewdate BETWEEN '2013-01-01' AND '2013-12-31'
Database: beer_factory
Note: full name = first, last; how long ago = SUBTRACT(reviewdate, firstpurchasedate);
Question: Give me the full name of the first customer, and tell me how long ago he or she wrote his or her first review since making his or her first purchase.
SQL: SELECT customers.first, customers.last , strftime('%J', reviewdate) - strftime('%J', firstpurchasedate) AS timeago FROM customers INNER JOIN rootbeerreview ON customers.customerid = rootbeerreview.customerid LIMIT 1
Database: beer_factory
Note: FALSE;
Question: What is the credit card type used by Kenneth Walton?
SQL: SELECT DISTINCT transaction.creditcardtype FROM customers INNER JOIN `transaction` ON customers.customerid = transaction.customerid WHERE customers.first = 'Kenneth' AND customers.last = 'Walton'
Database: beer_factory
Note: FALSE;
Question: What is the container type, brand name and star rating for root beer ID 10054?
SQL: SELECT rootbeer.containertype, rootbeerbrand.brandname, rootbeerreview.starrating FROM rootbeerreview INNER JOIN `transaction` ON rootbeerreview.customerid = transaction.customerid INNER JOIN rootbeerbrand ON rootbeerreview.brandid = rootbeerbrand.brandid INNER JOIN rootbeer ON transaction.rootbeerid = rootbeer.rootbeerid WHERE transaction.rootbeerid = 100054
Database: beer_factory
Note: FALSE;
Question: List out the root beers bought by Tim Ocel and Dawn Childress.
SQL: SELECT transaction.rootbeerid FROM customers INNER JOIN `transaction` ON transaction.customerid = customers.customerid WHERE (customers.first = 'Tim' AND customers.last = 'Ocel') OR (customers.first = 'Dawn' AND customers.last = 'Childress')