db_id stringlengths 4 31 | SQL stringlengths 18 1.45k | input_sequence stringlengths 148 11k | question stringlengths 16 325 |
|---|---|---|---|
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 | Question: calculate the difference between the number of root beers sold that use cane sugar and corn syrup. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location... | calculate the difference between the number of root beers sold that use cane sugar and corn syrup. |
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 | Question: which brewery brewed the most sold root beer in 2015? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress, ... | which brewery brewed the most sold root beer in 2015? |
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.... | Question: among the male customers in sacramento, what percentage bought dominion root beer in 2013? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> Loca... | among the male customers in sacramento, what percentage bought dominion root beer in 2013? |
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`... | Question: what is the difference in the average number of sales per day of root beer brands that contain honey and that dont contain honey. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID... | what is the difference in the average number of sales per day of root beer brands that contain honey and that dont contain honey. |
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' | Question: find and list the full name and email of the customers who used american express cards in sac state union. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. ... | find and list the full name and email of the customers who used american express cards in sac state union. |
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' | Question: in the reviews of september 2014. which brand of beers obtained the highest star ratings? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> Locat... | in the reviews of september 2014. which brand of beers obtained the highest star ratings? |
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' | Question: what is the precise location of all paying customers with american express? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, Locatio... | what is the precise location of all paying customers with american express? |
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' | Question: how many folsom customers prefer to pay with visa? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress, Cit... | how many folsom customers prefer to pay with visa? |
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' | Question: from which cities are the customers who gave 5 stars in their reviews in november 2012? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> Locatio... | from which cities are the customers who gave 5 stars in their reviews in november 2012? |
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' | Question: what brands of beer has peg winchester consumed? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress, City,... | what brands of beer has peg winchester consumed? |
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 | Question: what brand of beer has been the worst rated most times? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress... | what brand of beer has been the worst rated most times? |
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 | Question: what credit card is the most used in the purchase of non-alcoholic beer? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationNa... | what credit card is the most used in the purchase of non-alcoholic beer? |
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 | Question: what is the name of all the customers who have ever given a 5-star review? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, Location... | what is the name of all the customers who have ever given a 5-star review? |
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 | Question: at what latitude is the thomas kemper brand beer consumed the most? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, S... | at what latitude is the thomas kemper brand beer consumed the most? |
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 | Question: what star rating is the most common for beers containing corn syrup? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, ... | what star rating is the most common for beers containing corn syrup? |
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 | Question: what is the precise location of zip code 95819? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress, City, ... | what is the precise location of zip code 95819? |
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' | Question: what brands of beers are manufactured at coordinates 38,566,129, -121,426,432? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, Loca... | what brands of beers are manufactured at coordinates 38,566,129, -121,426,432? |
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' | Question: what is the average unit profit for wholesalers of canned beers? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, Stre... | what is the average unit profit for wholesalers of canned beers? |
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' | Question: what percentage of customers who paid with a discover credit card gave a 3-star rating? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> Locatio... | what percentage of customers who paid with a discover credit card gave a 3-star rating? |
beer_factory | select brandid from rootbeerreview where starrating > 3 | Question: list the brand ids of the beers whose star rating is more than 3. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, Str... | list the brand ids of the beers whose star rating is more than 3. |
beer_factory | select count(brandid) from rootbeer where containertype = 'bottle' and purchasedate between '2015-04-03' and '2015-10-26' | Question: how many brands of bottle root beer were purchased between 4/3/2015 and 10/26/2015? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID,... | how many brands of bottle root beer were purchased between 4/3/2015 and 10/26/2015? |
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.' | 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? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. g... | 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? |
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' | Question: tally the email addresses and phone numbers of customers from sacramento who gave a star rating of more than 3 in 2014. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude... | tally the email addresses and phone numbers of customers from sacramento who gave a star rating of more than 3 in 2014. |
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' | Question: how many female mailing list subscribers from sacramento gave a 4-star rating between 1/3/2016 and 10/26/2016? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitu... | how many female mailing list subscribers from sacramento gave a 4-star rating between 1/3/2016 and 10/26/2016? |
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' | Question: give me the brewery and brand names of canned root beer that were purchased before 6/6/2015. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> Lo... | give me the brewery and brand names of canned root beer that were purchased before 6/6/2015. |
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 | Question: list the brand names of bottled root beer whose first brewing year is no later than 1930. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> Locat... | list the brand names of bottled root beer whose first brewing year is no later than 1930. |
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' | Question: how many times did anna himes use her mastercard when paying between 12/25/2014 and 5/20/2016 ? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location ->... | how many times did anna himes use her mastercard when paying between 12/25/2014 and 5/20/2016 ? |
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' | Question: what is the average star rating given by female customers to brand id 10018 from 1/25/2015 to 3/10/2015? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. lo... | what is the average star rating given by female customers to brand id 10018 from 1/25/2015 to 3/10/2015? |
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 | 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'? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> Lo... | 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'? |
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' | 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. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. ge... | 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. |
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' | Question: how many transactions were made in sac state union using the american express credit card in 2014? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location... | how many transactions were made in sac state union using the american express credit card in 2014? |
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' | Question: what is the precise coordinate of sac state union? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress, Cit... | what is the precise coordinate of sac state union? |
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' | Question: what did the customer say in his or her review of bulldog root beer on 7/26/2013? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, L... | what did the customer say in his or her review of bulldog root beer on 7/26/2013? |
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' | 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. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailL... | 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. |
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 | 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. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolo... | 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. |
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' | Question: what is the credit card type used by kenneth walton? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress, C... | what is the credit card type used by kenneth walton? |
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 | Question: what is the container type, brand name and star rating for root beer id 10054? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, Loca... | what is the container type, brand name and star rating for root beer id 10054? |
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') | Question: list out the root beers bought by tim ocel and dawn childress. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, Street... | list out the root beers bought by tim ocel and dawn childress. |
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') | Question: list out the root beer id for the brand bulldog, bundaberg, dad's, dog n suds and virgil's. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> Loc... | list out the root beer id for the brand bulldog, bundaberg, dad's, dog n suds and virgil's. |
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' | Question: how many bottles of beer have been bought by jim breech? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddres... | how many bottles of beer have been bought by jim breech? |
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' | Question: how many transactions have been made to purchase a root beer brand from california? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID,... | how many transactions have been made to purchase a root beer brand from california? |
beer_factory | select avg(t2.starrating) from customers as t1 inner join rootbeerreview as t2 on t1.customerid = t2.customerid where t1.subscribedtoemaillist = 'true' | Question: what is the average review given by a subscriber? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress, City... | what is the average review given by a subscriber? |
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 = ... | Question: what is the amount difference between the bottles of root beer sold from louisiana and missouri? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -... | what is the amount difference between the bottles of root beer sold from louisiana and missouri? |
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 | Question: what is the transaction ratio being made at sac state american river courtyard and sac state union? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. locatio... | what is the transaction ratio being made at sac state american river courtyard and sac state union? |
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 | Question: list out the name of the top 10 spenders and what credit card type are they using. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, ... | list out the name of the top 10 spenders and what credit card type are they using. |
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 | Question: list out root beer brand that is not caffeinated and not containing cane sugar. what is the total amount sold for this products? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID,... | list out root beer brand that is not caffeinated and not containing cane sugar. what is the total amount sold for this products? |
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 | Question: which of the root beer brand have the lowest purchase? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress,... | which of the root beer brand have the lowest purchase? |
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 | Question: what is the best seller root beer brand and what is the average star rating for this root beer? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location ->... | what is the best seller root beer brand and what is the average star rating for this root beer? |
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.rootbeer... | Question: what is the percentage difference of river city sale compare to frostie? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationNa... | what is the percentage difference of river city sale compare to frostie? |
beer_factory | select distinct city from customers where state = 'ca' | Question: please name all of the cities in california. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress, City, Sta... | please name all of the cities in california. |
beer_factory | select cast(count(case when gender = 'f' then 1 else null end) as real) * 100 / count(subscribedtoemaillist) from customers where subscribedtoemaillist = 'true' | Question: what is the percentage of female customers who subscribed to the email list? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, Locati... | what is the percentage of female customers who subscribed to the email list? |
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' | Question: which type of card did dick ruthven use to pay for all of his transactions? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, Locatio... | which type of card did dick ruthven use to pay for all of his transactions? |
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' | Question: how many transactions were made at sac state union? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress, Ci... | how many transactions were made at sac state union? |
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' | Question: how many stars did urijah faber rate for frostie? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress, City... | how many stars did urijah faber rate for frostie? |
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!' | Question: which brand has the lowest star rating with a 'too spicy!' review? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, St... | which brand has the lowest star rating with a 'too spicy!' review? |
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' | Question: how many purchases were made at sac state american river courtyard using master card? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationI... | how many purchases were made at sac state american river courtyard using master card? |
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%' | Question: which brand in 2012 has the lowest star rating and contains cane sugar as well as honey? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> Locati... | which brand in 2012 has the lowest star rating and contains cane sugar as well as honey? |
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%' | Question: what is the precise location of the place where tommy kono made a purchase in 2014? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID,... | what is the precise location of the place where tommy kono made a purchase in 2014? |
beer_factory | select t1.email from customers as t1 inner join `transaction` as t2 on t1.customerid = t2.customerid where t2.transactionid = '100016' | Question: what is the email address of the customer who made a purchase in transaction 100016? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID... | what is the email address of the customer who made a purchase in transaction 100016? |
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' | Question: how many transactions were made to purchase a bottle of beer using american express? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID... | how many transactions were made to purchase a bottle of beer using american express? |
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 | Question: which location sold more bottles of beer? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationName, StreetAddress, City, State,... | which location sold more bottles of beer? |
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 | Question: please name any three root beer brands that have the highest market evaluation and acceptance. | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> ... | please name any three root beer brands that have the highest market evaluation and acceptance. |
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' | Question: what is the precise location of the sac state american river courtyard? | Tables: customers -> CustomerID, First, Last, StreetAddress, City, State, ZipCode, Email, PhoneNumber, FirstPurchaseDate, SubscribedToEmailList, Gender. geolocation -> LocationID, Latitude, Longitude. location -> LocationID, LocationNam... | what is the precise location of the sac state american river courtyard? |
sales | select count(salesid) from sales where customerid = 80 | Question: how many sales ids are there for customer id 80? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.ProductID = ... | how many sales ids are there for customer id 80? |
sales | select sum(quantity) from sales where salesid between 1 and 10 | Question: count the total quantity for sales from id 1 to 10. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.ProductID... | count the total quantity for sales from id 1 to 10. |
sales | select avg(quantity) from sales where salesid between 20 and 30 | Question: calculate the average quantity per sales from sales id 20 to 30. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sa... | calculate the average quantity per sales from sales id 20 to 30. |
sales | select distinct productid from sales where quantity = ( select max(quantity) from sales ) | Question: list down the product id for products with the highest quantity. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sa... | list down the product id for products with the highest quantity. |
sales | select count(distinct productid) from products where price = ( select max(price) from products ) | Question: how many product ids have the lowest price? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.ProductID = Produ... | how many product ids have the lowest price? |
sales | select name from products where price = 0 | Question: list down product names of free gifts. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.ProductID = Products.P... | list down product names of free gifts. |
sales | select name from products where productid between 1 and 10 | Question: list down the product name for products from id 1 to 10. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.Prod... | list down the product name for products from id 1 to 10. |
sales | select t2.name from sales as t1 inner join products as t2 on t1.productid = t2.productid order by t1.quantity limit 1 | Question: what is the name of the product with the lowest quantity? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.Pro... | what is the name of the product with the lowest quantity? |
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' | Question: how many customer ids have purchased hex nut 9? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.ProductID = P... | how many customer ids have purchased hex nut 9? |
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' | Question: calculate the total sales ids that were sales of flat washer 8. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sal... | calculate the total sales ids that were sales of flat washer 8. |
sales | select distinct t1.name from products as t1 inner join sales as t2 on t1.productid = t2.productid where t2.salespersonid = 10 | Question: list down all of the product names that were placed by sales person with id 10. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quanti... | list down all of the product names that were placed by sales person with id 10. |
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 | Question: list down the first name of customers who placed order for product id 1. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | J... | list down the first name of customers who placed order for product id 1. |
sales | select t1.lastname from customers as t1 inner join sales as t2 on t1.customerid = t2.customerid where t2.salesid = 178 | Question: what is the last name of the customer who placed an order for sales id 178? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. ... | what is the last name of the customer who placed an order for sales id 178? |
sales | select distinct t1.productid from sales as t1 inner join customers as t2 on t1.customerid = t2.customerid where t2.firstname = 'abby' | Question: list down product ids that were purchased by customers called abby. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins:... | list down product ids that were purchased by customers called abby. |
sales | select distinct t2.productid from employees as t1 inner join sales as t2 on t1.employeeid = t2.salespersonid where t1.firstname = 'meander' | Question: write down all of the product ids that were placed by meander. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sale... | write down all of the product ids that were placed by meander. |
sales | select t1.lastname from employees as t1 inner join sales as t2 on t1.employeeid = t2.salespersonid where t2.salesid = 100 | Question: what is the last name of sales person for sales id 100? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.Produ... | what is the last name of sales person for sales id 100? |
sales | select distinct t3.firstname from customers as t1 inner join sales as t2 on t1.customerid = t2.customerid inner join employees as t3 on t2.salespersonid = t3.employeeid where t1.firstname = 'abigail' | Question: what is the first name of employee who handled sales for customer called abigail? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quan... | what is the first name of employee who handled sales for customer called abigail? |
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 | Question: how many free gifts have customer with id 11782 received? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.Pro... | how many free gifts have customer with id 11782 received? |
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 | Question: what is the full name of customers who dealt with sales person with id 5? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | ... | what is the full name of customers who dealt with sales person with id 5? |
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' | Question: list down all of the sales ids for sales handled by sales people with first name starting with alphabet 's'. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, ... | list down all of the sales ids for sales handled by sales people with first name starting with alphabet 's'. |
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 | Question: among customers with ids from 1 to 100, what is the highest price of products they purchased? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, Pro... | among customers with ids from 1 to 100, what is the highest price of products they purchased? |
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 | Question: among customers with the last name of valdez, who purchased the highest quantity? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quan... | among customers with the last name of valdez, who purchased the highest quantity? |
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 | Question: sum up the number sales ids handled by employees called morningstar, heather and dean. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID,... | sum up the number sales ids handled by employees called morningstar, heather and dean. |
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' | Question: has alex purchased product with id 498? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.ProductID = Products.... | has alex purchased product with id 498? |
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' | Question: calculate the total price of products purchased by adam. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.Prod... | calculate the total price of products purchased by adam. |
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 | Question: calculate the total price for products from id 400 to 500. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.Pr... | calculate the total price for products from id 400 to 500. |
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' | Question: calculate the total quantity of products with name starting with alphabet 'c'. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantit... | calculate the total quantity of products with name starting with alphabet 'c'. |
sales | select sum(t2.quantity) from customers as t1 inner join sales as t2 on t1.customerid = t2.customerid where t1.firstname = 'adam' | Question: calculate the total quantity of products purchased by customer called adrian. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity... | calculate the total quantity of products purchased by customer called adrian. |
sales | select productid from products order by price desc limit 5 | Question: list the product id of the top five products, by descending order, in terms of price. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, ... | list the product id of the top five products, by descending order, in terms of price. |
sales | select count(productid) from products where price = 0 | Question: among the products, how many of them are freebies? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.ProductID ... | among the products, how many of them are freebies? |
sales | select distinct t1.name from products as t1 inner join sales as t2 on t1.productid = t2.productid where t2.quantity > 950 | Question: write down the name of products whose sale quantity is more than 950. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Join... | write down the name of products whose sale quantity is more than 950. |
sales | select distinct t2.firstname, t2.middleinitial, t2.lastname from sales as t1 inner join employees as t2 on t1.salespersonid = t2.employeeid where t1.quantity = 1000 | Question: what is the full name of employee who sold 1000 units? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.Produc... | what is the full name of employee who sold 1000 units? |
sales | select t3.name, t2.quantity from customers as t1 inner join sales as t2 on t1.customerid = t2.customerid inner join products as t3 on t2.productid = t3.productid where t2.salesid between 1 and 10 | Question: tally the product name and quantity of the first ten sales. | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.P... | tally the product name and quantity of the first ten sales. |
sales | select sum(t1.price * t2.quantity) from products as t1 inner join sales as t2 on t1.productid = t2.productid where t1.name = 'reflector' | Question: what is the total sales amount for reflector? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.ProductID = Pro... | what is the total sales amount for reflector? |
sales | select iif(sum(iif(t1.name = 'hl mountain frame - silver, 42', t2.salesid, 0)) - sum(iif(t1.name = 'hl mountain frame - black, 42', t2.salesid, 0)) > 0, 'silver', 'black') from products as t1 inner join sales as t2 on t1.productid = t2.productid | Question: what is the best selling colour for hl mountain frame, 42? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: Sales.Pr... | what is the best selling colour for hl mountain frame, 42? |
sales | select ( select price from products where name = 'hl mountain frame - black, 42' ) - ( select price from products where name = 'll mountain frame - black, 42' ) as num | Question: what is the difference in price between hl mountain frame - black, 42 and ll mountain frame - black, 42? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, Cust... | what is the difference in price between hl mountain frame - black, 42 and ll mountain frame - black, 42? |
sales | select count(t1.salesid) from sales as t1 inner join employees as t2 on t1.salespersonid = t2.employeeid where t2.firstname = 'michel' and t2.middleinitial = 'e' and t2.lastname = 'defrance' | Question: calculate the total number of sales closed by michel e. defrance? | Tables: Customers -> CustomerID, FirstName, MiddleInitial, LastName. Employees -> EmployeeID, FirstName, MiddleInitial, LastName. Products -> ProductID, Name, Price. Sales -> SalesID, SalesPersonID, CustomerID, ProductID, Quantity. | Joins: S... | calculate the total number of sales closed by michel e. defrance? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.