problem
stringlengths
121
422
db_id
stringclasses
69 values
solution
stringlengths
23
804
Write SQL query to solve given problem: Give the name of the brands that brewed their first drink between 1996 and 2000 in the descending order of the date brewed.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT BrandName FROM rootbeerbrand WHERE FirstBrewedYear BETWEEN '1996' AND '2000' ORDER BY FirstBrewedYear DESC
Write SQL query to solve given problem: Find the brand Id of the root beer which has the most number of customers who gave 1-star ratings.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT BrandID FROM rootbeerreview WHERE StarRating = 1 GROUP BY BrandID ORDER BY COUNT(BrandID) DESC LIMIT 1
Write SQL query to solve given problem: Among the transactions, what percentage is done by using a visa card?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT CAST(COUNT(CASE WHEN CreditCardType = 'Visa' THEN TransactionID ELSE NULL END) AS REAL) * 100 / COUNT(TransactionID) FROM `transaction`
Write SQL query to solve given problem: How many brands of root beers are available in cans and contain corn syrup and artificial sweeteners?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(BrandID) FROM rootbeerbrand WHERE CornSyrup = 'TRUE' AND ArtificialSweetener = 'TRUE' AND AvailableInCans = 'TRUE'
Write SQL query to solve given problem: Calculate the percentage of sales done at Sac State American River Courtyard.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
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
Write SQL query to solve given problem: On average how many caffeinated root beers are sold a day?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
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'
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
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 )
Write SQL query to solve given problem: What is the average cost of root beers purchased for more than 2 dollars and sold in bottles?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT AVG(T2.PurchasePrice) 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 T1.ContainerType = 'Bottle' AND T2.PurchasePrice > 2
Write SQL query to solve given problem: Among the root beers sold in bottles, how many are sold at the location 38.559615, -121.42243?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(T4.BrandID) FROM `transaction` AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID INNER JOIN location AS T3 ON T1.LocationID = T3.LocationID INNER JOIN rootbeer AS T4 ON T1.RootBeerID = T4.RootBeerID WHERE T2.Latitude = 38.559615 AND T2.Longitude = -121.42243 AND T4.ContainerType = 'Bottle'
Write SQL query to solve given problem: Among the customers not subscribed to the mailing list, what percentage has given three or more stars in a review?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT CAST(COUNT(CASE WHEN T2.StarRating > 3 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.CustomerID) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.SubscribedToEmailList = 'FALSE'
Write SQL query to solve given problem: Which root beer got the most five stars in 2012? Give the brand name of this beer.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T3.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.StarRating = 5 AND strftime('%Y', T2.ReviewDate) = '2012' GROUP BY T1.BrandID ORDER BY COUNT(T2.BrandID) DESC LIMIT 1
Write SQL query to solve given problem: In the female customers, how many bought root beer that contains artificial sweetener?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
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.Gender = 'F' AND T4.ArtificialSweetener = 'TRUE'
Write SQL query to solve given problem: Calculate the difference between the number of root beers sold that use cane sugar and corn syrup.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(CASE WHEN T3.CaneSugar = 'TRUE' THEN T1.BrandID ELSE NULL END) - COUNT(CASE WHEN T3.CornSyrup = 'TRUE' THEN T1.BrandID ELSE NULL END) AS DIFFERENCE FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID
Write SQL query to solve given problem: Which brewery brewed the most sold root beer in 2015?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T3.BreweryName 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 '2015%' GROUP BY T3.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1
Write SQL query to solve given problem: Among the male customers in Sacramento, what percentage bought Dominion root beer in 2013?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT CAST(COUNT(CASE WHEN T4.BrandName = 'Dominion' THEN T1.CustomerID ELSE NULL END) AS REAL) * 100 / 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.City = 'Sacramento' AND T1.Gender = 'M' AND T2.TransactionDate LIKE '2014%'
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT (CAST(SUM(CASE WHEN T1.Honey = 'TRUE' THEN 1 ELSE 0 END) AS REAL) / COUNT(DISTINCT T3.TransactionDate)) - (CAST(SUM(CASE WHEN T1.Honey <> 'TRUE' THEN 1 ELSE 0 END) AS REAL) / COUNT(DISTINCT T3.TransactionDate)) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID
Write SQL query to solve given problem: Find and list the full name and email of the customers who used American Express cards in Sac State Union.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT T1.First, T1.Last, T1.Email FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN location AS T3 ON T2.LocationID = T3.LocationID WHERE T3.LocationName = 'Sac State Union' AND T2.CreditCardType = 'American Express'
Write SQL query to solve given problem: In the reviews of September 2014. Which brand of beers obtained the highest star ratings?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 AND T2.ReviewDate BETWEEN '2014-09-01' AND '2014-09-30'
Write SQL query to solve given problem: What is the precise location of all paying customers with American Express?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT T2.Latitude, T2.Longitude FROM `transaction` AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.CreditCardType = 'American Express'
Write SQL query to solve given problem: How many Folsom customers prefer to pay with Visa?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.City = 'Folsom' AND T2.CreditCardType = 'Visa'
Write SQL query to solve given problem: From which cities are the customers who gave 5 stars in their reviews in November 2012?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT T1.City FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 5 AND T2.ReviewDate BETWEEN '2012-11-01' AND '2012-11-30'
Write SQL query to solve given problem: What brands of beer has Peg Winchester consumed?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
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 = 'Peg' AND T1.Last = 'Winchester'
Write SQL query to solve given problem: What brand of beer has been the worst rated most times?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T2.BrandID = T1.BrandID WHERE T2.StarRating = 1 GROUP BY T1.BrandName ORDER BY COUNT(T1.BrandName) DESC LIMIT 1
Write SQL query to solve given problem: What credit card is the most used in the purchase of non-alcoholic beer?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T2.CreditCardType 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 T3.Alcoholic = 'FALSE' GROUP BY T2.CreditCardType ORDER BY COUNT(T2.CreditCardType) DESC LIMIT 1
Write SQL query to solve given problem: What is the name of all the customers who have ever given a 5-star review?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 5
Write SQL query to solve given problem: At what latitude is the Thomas Kemper brand beer consumed the most?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T3.Latitude FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN geolocation AS T3 ON T1.LocationID = T3.LocationID WHERE T2.BrandName = 'Thomas Kemper' GROUP BY T3.Latitude ORDER BY COUNT(T1.BrandID) DESC LIMIT 1
Write SQL query to solve given problem: What star rating is the most common for beers containing corn syrup?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T2.StarRating FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.CornSyrup = 'TRUE' GROUP BY T2.StarRating ORDER BY COUNT(T2.StarRating) DESC LIMIT 1
Write SQL query to solve given problem: What is the precise location of zip code 95819?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T2.Latitude, T2.Longitude FROM location AS T1 INNER JOIN geolocation AS T2 ON T1.LocationID = T2.LocationID WHERE T1.ZipCode = 95819
Write SQL query to solve given problem: What brands of beers are manufactured at coordinates 38,566,129, -121,426,432?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT T2.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN geolocation AS T3 ON T1.LocationID = T3.LocationID WHERE T3.Latitude = '38.566129' AND T3.Longitude = '-121.426432'
Write SQL query to solve given problem: What is the average unit profit for wholesalers of canned beers?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT AVG(T2.CurrentRetailPrice - T2.WholesaleCost) FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T1.ContainerType = 'Can'
Write SQL query to solve given problem: What percentage of customers who paid with a Discover Credit Card gave a 3-star rating?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT CAST(COUNT(CASE WHEN T1.StarRating = 3 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.CustomerID) FROM rootbeerreview AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.CreditCardType = 'Discover'
Write SQL query to solve given problem: List the brand IDs of the beers whose star rating is more than 3.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT BrandID FROM rootbeerreview WHERE StarRating > 3
Write SQL query to solve given problem: How many brands of bottle root beer were purchased between 4/3/2015 and 10/26/2015?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(BrandID) FROM rootbeer WHERE ContainerType = 'Bottle' AND PurchaseDate BETWEEN '2015-04-03' AND '2015-10-26'
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 5 AND T2.Review = 'The quintessential dessert root beer. No ice cream required.'
Write SQL query to solve given problem: Tally the email addresses and phone numbers of customers from Sacramento who gave a star rating of more than 3 in 2014.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT T1.Email, T1.PhoneNumber FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating > 3 AND T1.City = 'Sacramento' AND T2.ReviewDate BETWEEN '2014-01-01' AND '2014-12-31'
Write SQL query to solve given problem: How many female mailing list subscribers from Sacramento gave a 4-star rating between 1/3/2016 and 10/26/2016?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.StarRating = 4 AND T1.City = 'Sacramento' AND T1.Gender = 'F' AND T1.SubscribedToEmailList = 'TRUE' AND T2.ReviewDate BETWEEN '2013-01-03' AND '2013-10-26'
Write SQL query to solve given problem: Give me the brewery and brand names of canned root beer that were purchased before 6/6/2015.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT T2.BreweryName, T2.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T1.PurchaseDate < '2015-06-06' AND T1.ContainerType = 'Can'
Write SQL query to solve given problem: List the brand names of bottled root beer whose first brewing year is no later than 1930.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T2.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T2.FirstBrewedYear < '1930-01-01' AND T1.ContainerType = 'Bottle' ORDER BY T2.FirstBrewedYear LIMIT 1
Write SQL query to solve given problem: How many times did Anna Himes use her Mastercard when paying between 12/25/2014 and 5/20/2016 ?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(T2.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Anna' AND T1.Last = 'Himes' AND T2.CreditCardType = 'MasterCard' AND T2.TransactionDate BETWEEN '2014-12-25' AND '2016-05-20'
Write SQL query to solve given problem: What is the average star rating given by female customers to brand ID 10018 from 1/25/2015 to 3/10/2015?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT AVG(T2.StarRating) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.BrandID = 10018 AND T1.Gender = 'F' AND T2.ReviewDate BETWEEN '2013-01-25' AND '2015-03-10'
Write SQL query to solve given problem: 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"?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.CustomerID = 331115 AND T2.Review = 'Yuk, more like licorice soda.' AND T2.StarRating = 1
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT SUM(T1.PurchasePrice) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State American River Courtyard' AND T1.CreditCardType = 'Visa' AND T1.TransactionDate BETWEEN '2014-06-03' AND '2015-11-27'
Write SQL query to solve given problem: How many transactions were made in Sac State Union using the American Express credit card in 2014?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(T1.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State Union' AND T1.CreditCardType = 'American Express' AND T1.TransactionDate BETWEEN '2014-01-01' AND '2014-12-31'
Write SQL query to solve given problem: What is the precise coordinate of Sac State Union?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
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'
Write SQL query to solve given problem: What did the customer say in his or her review of Bulldog root beer on 7/26/2013?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T2.Review FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.BrandName = 'Bulldog' AND T2.ReviewDate = '2013-07-26'
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T1.BrandName, T1.CurrentRetailPrice - T1.WholesaleCost AS result FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 AND T2.ReviewDate BETWEEN '2013-01-01' AND '2013-12-31'
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T1.First, T1.Last , strftime('%J', ReviewDate) - strftime('%J', FirstPurchaseDate) AS TIMEAGO FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID LIMIT 1
Write SQL query to solve given problem: What is the credit card type used by Kenneth Walton?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT T2.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Kenneth' AND T1.Last = 'Walton'
Write SQL query to solve given problem: What is the container type, brand name and star rating for root beer ID 10054?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T4.ContainerType, T3.BrandName, T1.StarRating FROM rootbeerreview AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID INNER JOIN rootbeer AS T4 ON T2.RootBeerID = T4.RootBeerID WHERE T2.RootBeerID = 100054
Write SQL query to solve given problem: List out the root beers bought by Tim Ocel and Dawn Childress.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T2.RootBeerID FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T2.CustomerID = T1.CustomerID WHERE (T1.First = 'Tim' AND T1.Last = 'Ocel') OR (T1.First = 'Dawn' AND T1.Last = 'Childress')
Write SQL query to solve given problem: List out the root beer ID for the brand Bulldog, Bundaberg, Dad's, Dog n Suds and Virgil's.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T1.RootBeerID FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T2.BrandID = T1.BrandID WHERE T2.BrandName IN ('Bulldog', 'Bundaberg', 'Dad''s', 'Dog n Suds', 'Virgil''s')
Write SQL query to solve given problem: How many bottles of beer have been bought by Jim Breech?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(T3.ContainerType) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T2.CustomerID = T1.CustomerID INNER JOIN rootbeer AS T3 ON T3.RootBeerID = T2.RootBeerID WHERE T3.ContainerType = 'Bottle' AND T1.First = 'Jim' AND T1.Last = 'Breech'
Write SQL query to solve given problem: How many transactions have been made to purchase a root beer brand from California?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(T3.RootBeerID) 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.State = 'CA'
Write SQL query to solve given problem: What is the average review given by a subscriber?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT AVG(T2.StarRating) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.SubscribedToEmailList = 'TRUE'
Write SQL query to solve given problem: What is the amount difference between the bottles of root beer sold from Louisiana and Missouri?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT ( SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T2.State = 'LA' AND T1.ContainerType = 'Bottle' ) - ( SELECT COUNT(T3.BrandID) FROM rootbeer AS T3 INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T4.State = 'MO' AND T3.ContainerType = 'Bottle' ) AS DIFFERENCE
Write SQL query to solve given problem: What is the transaction ratio being made at Sac State American River Courtyard and Sac State Union?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT CAST(COUNT(CASE WHEN T2.LocationName = 'Sac State American River Courtyard' THEN T1.TransactionID ELSE NULL END) AS REAL) * 100 / COUNT(CASE WHEN T2.LocationName = 'Sac State Union' THEN T1.TransactionID ELSE NULL END) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID
Write SQL query to solve given problem: List out the name of the top 10 spenders and what credit card type are they using.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T1.First, T1.Last, T2.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID GROUP BY T1.CustomerID ORDER BY SUM(T2.PurchasePrice) DESC LIMIT 10
Write SQL query to solve given problem: List out root beer brand that is not caffeinated and not containing cane sugar. What is the total amount sold for this products?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T1.BrandName, SUM(T3.PurchasePrice) FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID INNER JOIN `transaction` AS T3 ON T2.RootBeerID = T3.RootBeerID WHERE T1.CaneSugar = 'FALSE' AND T1.Caffeinated = 'FALSE' GROUP BY T1.BrandName
Write SQL query to solve given problem: Which of the root beer brand have the lowest purchase?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T2.BrandName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) LIMIT 1
Write SQL query to solve given problem: What is the best seller root beer brand and what is the average star rating for this root beer?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T1.BrandID, AVG(T1.StarRating) FROM rootbeerreview AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID GROUP BY T3.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1
Write SQL query to solve given problem: What is the percentage difference of River City sale compare to Frostie?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT CAST((SUM(CASE WHEN T3.BrandName = 'River City' THEN T2.PurchasePrice ELSE 0 END) - SUM(CASE WHEN T3.BrandName = 'Frostie' THEN T2.PurchasePrice ELSE 0 END)) AS REAL) * 100 / SUM(CASE WHEN T3.BrandName = 'Frostie' THEN T2.PurchasePrice ELSE 0 END) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID
Write SQL query to solve given problem: Please name all of the cities in California.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT City FROM customers WHERE State = 'CA'
Write SQL query to solve given problem: What is the percentage of female customers who subscribed to the email list?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT CAST(COUNT(CASE WHEN Gender = 'F' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(SubscribedToEmailList) FROM customers WHERE SubscribedToEmailList = 'TRUE'
Write SQL query to solve given problem: Which type of card did Dick Ruthven use to pay for all of his transactions?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT T2.CreditCardType FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Dick' AND T1.Last = 'Ruthven'
Write SQL query to solve given problem: How many transactions were made at Sac State Union?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(T1.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State Union'
Write SQL query to solve given problem: How many stars did Urijah Faber rate for Frostie?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T2.StarRating FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T2.BrandID = T3.BrandID WHERE T1.First = 'Urijah' AND T1.Last = 'Faber' AND T3.BrandName = 'Frostie'
Write SQL query to solve given problem: Which brand has the lowest star rating with a "Too spicy!" review?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T2.BrandID = T1.BrandID WHERE T2.StarRating = 1 AND T2.Review = 'Too Spicy!'
Write SQL query to solve given problem: How many purchases were made at Sac State American River Courtyard using Master Card?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(T1.TransactionID) FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T2.LocationName = 'Sac State American River Courtyard' AND T1.CreditCardType = 'MasterCard'
Write SQL query to solve given problem: Which brand in 2012 has the lowest star rating and contains cane sugar as well as honey?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.CaneSugar = 'TRUE' AND T1.Honey = 'TRUE' AND T2.StarRating = 1 AND T2.ReviewDate LIKE '2012%'
Write SQL query to solve given problem: What is the precise location of the place where Tommy Kono made a purchase in 2014?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT T1.Latitude, T1.Longitude FROM geolocation AS T1 INNER JOIN `transaction` AS T2 ON T2.LocationID = T1.LocationID INNER JOIN customers AS T3 ON T3.CustomerID = T2.CustomerID WHERE T3.First = 'Tommy' AND T3.Last = 'Kono' AND T2.TransactionDate LIKE '2014%'
Write SQL query to solve given problem: What is the email address of the customer who made a purchase in transaction 100016?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT T1.Email FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.TransactionID = '100016'
Write SQL query to solve given problem: How many transactions were made to purchase a bottle of beer using American Express?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT COUNT(T1.RootBeerID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID WHERE T1.ContainerType = 'Bottle' AND T2.CreditCardType = 'American Express'
Write SQL query to solve given problem: Which location sold more bottles of beer?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
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
Write SQL query to solve given problem: Please name any three root beer brands that have the highest market evaluation and acceptance.. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
SELECT DISTINCT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 LIMIT 3
Write SQL query to solve given problem: What is the precise location of the Sac State American River Courtyard?. Keep the solution inside sql tag ```sql [SQL-Query] ```
beer_factory
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'
Write SQL query to solve given problem: How many sales ids are there for customer id 80?. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT COUNT(SalesID) FROM Sales WHERE CustomerID = 80
Write SQL query to solve given problem: Count the total quantity for sales from id 1 to 10.. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT SUM(Quantity) FROM Sales WHERE SalesID BETWEEN 1 AND 10
Write SQL query to solve given problem: Calculate the average quantity per sales from sales id 20 to 30.. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT AVG(Quantity) FROM Sales WHERE SalesID BETWEEN 20 AND 30
Write SQL query to solve given problem: List down product names of free gifts.. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT Name FROM Products WHERE Price = 0
Write SQL query to solve given problem: List down the product name for products from id 1 to 10.. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT Name FROM Products WHERE ProductID BETWEEN 1 AND 10
Write SQL query to solve given problem: What is the name of the product with the lowest quantity?. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT T2.Name FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID ORDER BY T1.Quantity LIMIT 1
Write SQL query to solve given problem: How many customer ids have purchased Hex Nut 9?. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT COUNT(T1.CustomerID) FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Hex Nut 9'
Write SQL query to solve given problem: Calculate the total sales ids that were sales of Flat Washer 8.. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT COUNT(T1.SalesID) FROM Sales AS T1 INNER JOIN Products AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Name = 'Flat Washer 8'
Write SQL query to solve given problem: List down all of the product names that were placed by sales person with id 10.. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT DISTINCT T1.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.SalesPersonID = 10
Write SQL query to solve given problem: List down the first name of customers who placed order for product id 1.. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
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
Write SQL query to solve given problem: What is the last name of the customer who placed an order for sales id 178?. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT T1.LastName FROM Customers AS T1 INNER JOIN Sales AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.SalesID = 178
Write SQL query to solve given problem: What is the last name of sales person for sales id 100?. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT T1.LastName FROM Employees AS T1 INNER JOIN Sales AS T2 ON T1.EmployeeID = T2.SalesPersonID WHERE T2.SalesID = 100
Write SQL query to solve given problem: How many free gifts have customer with id 11782 received?. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
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
Write SQL query to solve given problem: What is the full name of customers who dealt with sales person with id 5?. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
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
Write SQL query to solve given problem: List down all of the sales IDs for sales handled by sales people with first name starting with alphabet "s".. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT T1.SalesID FROM Sales AS T1 INNER JOIN Employees AS T2 ON T1.SalesPersonID = T2.EmployeeID WHERE SUBSTR(T2.FirstName, 1, 1) = 's'
Write SQL query to solve given problem: Among customers with IDs from 1 to 100, what is the highest price of products they purchased?. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
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
Write SQL query to solve given problem: Among customers with the last name of Valdez, who purchased the highest quantity?. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
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
Write SQL query to solve given problem: Sum up the number sales ids handled by employees called Morningstar, Heather and Dean.. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
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
Write SQL query to solve given problem: Has Alex purchased product with id 498?. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
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'
Write SQL query to solve given problem: Calculate the total price of products purchased by Adam.. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
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'
Write SQL query to solve given problem: Calculate the total price for products from id 400 to 500.. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
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
Write SQL query to solve given problem: Calculate the total quantity of products with name starting with alphabet "c".. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
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'
Write SQL query to solve given problem: List the product ID of the top five products, by descending order, in terms of price.. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT ProductID FROM Products ORDER BY Price DESC LIMIT 5
Write SQL query to solve given problem: Among the products, how many of them are freebies?. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT COUNT(ProductID) FROM Products WHERE Price = 0
Write SQL query to solve given problem: Write down the name of products whose sale quantity is more than 950.. Keep the solution inside sql tag ```sql [SQL-Query] ```
sales
SELECT DISTINCT T1.Name FROM Products AS T1 INNER JOIN Sales AS T2 ON T1.ProductID = T2.ProductID WHERE T2.Quantity > 950