input
stringlengths
122
2.7k
output
stringlengths
24
805
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT DISTINCT T1.county FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.population_2010 > 10000;
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT T1.county FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code GROUP BY T1.county ORDER BY T2.households DESC LIMIT 1;
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT CAST(COUNT(CASE WHEN T2.households > 10000 THEN T1.zip_code ELSE NULL END) AS REAL) * 100 / COUNT(T1.zip_code) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code;
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT CAST(COUNT(CASE WHEN T2.type = 'Post Office' THEN T1.zip_code ELSE NULL END) AS REAL) * 100 / COUNT(T1.zip_code) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.county = 'SAINT CROIX';
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT DISTINCT T2.county FROM area_code AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code INNER JOIN zip_data AS T3 ON T1.zip_code = T3.zip_code WHERE T1.area_code = '787' AND T3.type = 'Unique Post Office';
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT T2.elevation FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.alias = 'East Longmeadow';
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT COUNT(T1.area_code) FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.daylight_savings = 'No';
[INST] Here is a database schema: area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation Please write me a SQL statement that answers the followin...
SELECT T2.county, T1.area_code FROM area_code AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T1.zip_code = 1116;
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT DISTINCT T2.type FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.alias = 'St Thomas';
[INST] Here is a database schema: state : abbreviation [ TEXT ] primary_key name [ TEXT ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] ...
SELECT T3.city FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state INNER JOIN zip_data AS T3 ON T2.zip_code = T3.zip_code WHERE T1.name = 'Oklahoma' AND T2.county = 'NOBLE';
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.water_area = ( SELECT MAX(water_area) FROM zip_data );
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.population_2020 = ( SELECT MAX(population_2020) FROM zip_data );
[INST] Here is a database schema: state : abbreviation [ TEXT ] primary_key name [ TEXT ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] ...
SELECT T3.elevation FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state INNER JOIN zip_data AS T3 ON T2.zip_code = T3.zip_code WHERE T1.name = 'Massachusetts' AND T2.county = 'HAMPDEN' GROUP BY T3.elevation;
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.hispanic_population = ( SELECT MAX(hispanic_population) FROM zip_data );
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.asian_population = 7;
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT AVG(T2.white_population) FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 920;
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT CAST(COUNT(CASE WHEN T2.county_fips < 20 THEN T2.zip_code ELSE NULL END) AS REAL) * 100 / COUNT(T2.zip_code) FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.alias = 'Ponce';
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT T1.county FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.population_2020 > 0.97 * ( SELECT AVG(population_2020) FROM zip_data );
[INST] Here is a database schema: congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_congress : zip_code [ INTEGER ] ...
SELECT COUNT(T2.zip_code) FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.first_name = 'Kirkpatrick' AND T1.last_name = 'Ann';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] ...
SELECT T2.zip_code, T2.latitude, T2.longitude FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Allentown-Bethlehem-Easton, PA-NJ';
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT T1.zip_code, T2.city, T2.latitude, T2.longitude FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.bad_alias = 'Shared Reshipper';
[INST] Here is a database schema: congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] prim...
SELECT T3.first_name, T3.last_name FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T1.city = 'Garfield';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] ...
SELECT COUNT(T2.zip_code) FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'New York-Newark-Jersey City, NY-NJ-PA';
[INST] Here is a database schema: congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_congress : zip_code [ INTEGER ] ...
SELECT COUNT(T2.zip_code) FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.state = 'Puerto Rico';
[INST] Here is a database schema: state : abbreviation [ TEXT ] primary_key name [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation Please write me a SQL statement that answers the following question: Describe the number of pos...
SELECT COUNT(DISTINCT T2.zip_code), COUNT(DISTINCT T2.county) FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'West Virginia';
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT T1.zip_code, T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.type = 'Community Post Office ' AND T2.elevation > 6000;
[INST] Here is a database schema: congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_congress : zip_code [ INTEGER ] ...
SELECT COUNT(T2.zip_code) FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.state = 'Mississippi';
[INST] Here is a database schema: zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ IN...
SELECT T2.district FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code WHERE T1.city = 'East Springfield';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] ...
SELECT T1.CBSA_name FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.employees = ( SELECT MAX(employees) FROM zip_data );
[INST] Here is a database schema: state : abbreviation [ TEXT ] primary_key name [ TEXT ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] ...
SELECT COUNT(T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Ohio' AND T2.type = 'Unique Post Office';
[INST] Here is a database schema: state : abbreviation [ TEXT ] primary_key name [ TEXT ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] ...
SELECT CAST(SUM(T2.total_beneficiaries) AS REAL) / COUNT(T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Guam';
[INST] Here is a database schema: congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_congress : zip_code [ INTEGER ] ...
SELECT CAST(SUM(CASE WHEN T1.party = 'Democrat' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*), SUM(CASE WHEN T1.state = 'Hawaii' THEN 1 ELSE 0 END) FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district;
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT BrandName FROM rootbeerbrand WHERE FirstBrewedYear = ( SELECT MIN(FirstBrewedYear) FROM rootbeerbrand );
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT COUNT(BrandID) FROM rootbeerbrand WHERE Country = 'United States';
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT BrandName FROM rootbeerbrand WHERE FacebookPage IS NOT NULL;
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT BrandName FROM rootbeerbrand ORDER BY CurrentRetailPrice - WholesaleCost LIMIT 1;
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT Description FROM rootbeerbrand WHERE BrandName = 'A&W';
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT City FROM rootbeerbrand WHERE BreweryName = 'AJ Stephans Beverages';
[INST] Please write me a SQL statement that answers the following question: How many transactions had Frank-Paul Santangelo made in July, 2014? [/INST] [/INST]
SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND STRFTIME('%Y-%m', T2.TransactionDate) = '2014-07';
[INST] Please write me a SQL statement that answers the following question: Among the transactions made in July, 2014, how many of them were made by a male customer? [/INST] [/INST]
SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Gender = 'M' AND STRFTIME('%Y-%m', T2.TransactionDate) = '2014-07';
[INST] Please write me a SQL statement that answers the following question: Among the users that permit the company to send regular emails to them, how many of them had made a transaction with a Visa card in July, 2014? [/INST] [/INST]
SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.SubscribedToEmailList = 'TRUE' AND T2.CreditCardType = 'Visa' AND STRFTIME('%Y-%m', T2.TransactionDate) = '2014-07';
[INST] Please write me a SQL statement that answers the following question: What is the full name of the customer that had made the most transactions in August, 2014? [/INST] [/INST]
SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE STRFTIME('%Y-%m', T2.TransactionDate) = '2014-08' GROUP BY T1.CustomerID ORDER BY COUNT(T2.CustomerID) DESC LIMIT 1;
[INST] Please write me a SQL statement that answers the following question: Please list the brands of all the root beer that Frank-Paul Santangelo had purchased on 2014/7/7. [/INST] [/INST]
SELECT DISTINCT T4.BrandName FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T2.TransactionDate = '2014-0...
[INST] Please write me a SQL statement that answers the following question: Of the 4 root beers that Frank-Paul Santangelo purchased on 2014/7/7, how many of them were in cans? [/INST] [/INST]
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 WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T2.TransactionDate = '2014-07-07' AND T3.ContainerType = 'Can';
[INST] Please write me a SQL statement that answers the following question: How many root beers of the Bulldog were purchased in August, 2014? [/INST] [/INST]
SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014-08%' AND T3.BrandName = 'Bulldog';
[INST] Please write me a SQL statement that answers the following question: Please list the full names of the customers who have purchased at least one root beer produced by AJ Stephans Beverages. [/INST] [/INST]
SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T4.BreweryName = 'AJ Stephans Beverages';
[INST] Please write me a SQL statement that answers the following question: Among the root beer brands that do not advertise on Twitter, how many of them have root beers sold in August, 2014? [/INST] [/INST]
SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014-08%' AND T3.Twitter IS NULL;
[INST] Please write me a SQL statement that answers the following question: What is the number of the credit card that Frank-Paul Santangelo used to purchase root beers on 2014/7/7? [/INST] [/INST]
SELECT DISTINCT T2.CreditCardNumber FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T2.TransactionDate = '2014-07-07';
[INST] Please write me a SQL statement that answers the following question: Among all the root beers purchased by Frank-Paul Santangelo, how many of them were non-sweetened? [/INST] [/INST]
SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T1.First = 'Frank-Paul' AND T1.Last = 'Santangelo' AND T4.ArtificialSweetener = 'FAL...
[INST] Please write me a SQL statement that answers the following question: Please list the dates on which a male customer has purchased more than 3 root beers. [/INST] [/INST]
SELECT T2.TransactionDate FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.Gender = 'M' GROUP BY T2.TransactionDate HAVING COUNT(T2.CustomerID) > 3;
[INST] Please write me a SQL statement that answers the following question: What is the average number of root beers of the brand A&W sold in a day in August, 2014? [/INST] [/INST]
SELECT CAST(COUNT(T1.BrandID) AS REAL) / 31 FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014-08%' AND T3.BrandName = 'A&W';
[INST] Please write me a SQL statement that answers the following question: Among all the root beers sold in 2014, what is the percentage of the root beers produced by the brewery AJ Stephans Beverages? [/INST] [/INST]
SELECT CAST(COUNT(CASE WHEN T3.BreweryName = 'AJ Stephans Beverages' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID WHERE T2.TransactionDate LIKE '2014%';
[INST] Here is a database schema: customers : CustomerID [ INTEGER ] primary_key First [ TEXT ] Last [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] Email [ TEXT ] PhoneNumber [ TEXT ] FirstPurchaseDate [ DATE ] SubscribedToEmailList [ TEXT ] Gender [ TEXT ] rootbeerreview : CustomerID ...
SELECT COUNT(T2.CustomerID) FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'James' AND T1.Last = 'House';
[INST] Please write me a SQL statement that answers the following question: Show the credit card number of Lisa Ling. [/INST] [/INST]
SELECT DISTINCT T2.CreditCardNumber FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Lisa' AND T1.Last = 'Ling';
[INST] Here is a database schema: geolocation : LocationID [ INTEGER ] primary_key geolocation.LocationID = location.LocationID Latitude [ REAL ] Longitude [ REAL ] location : LocationID [ INTEGER ] primary_key location.LocationID = geolocation.LocationID LocationName [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State...
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';
[INST] Please write me a SQL statement that answers the following question: Provide the name of the location where transaction no.100885 happened. [/INST] [/INST]
SELECT T2.LocationName FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.TransactionID = 100885;
[INST] Please write me a SQL statement that answers the following question: Which city does the customer who finished transaction no.103545 live in? [/INST] [/INST]
SELECT T1.City FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.TransactionID = 103545;
[INST] Please write me a SQL statement that answers the following question: What is the phone number of the customer who owns the credit card of number 6011179359005380? [/INST] [/INST]
SELECT DISTINCT T1.PhoneNumber FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.CreditCardNumber = 6011179359005382;
[INST] Here is a database schema: customers : CustomerID [ INTEGER ] primary_key First [ TEXT ] Last [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] Email [ TEXT ] PhoneNumber [ TEXT ] FirstPurchaseDate [ DATE ] SubscribedToEmailList [ TEXT ] Gender [ TEXT ] rootbeerreview : CustomerID ...
SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID GROUP BY T1.CustomerID ORDER BY COUNT(T2.CustomerID) DESC LIMIT 1;
[INST] Here is a database schema: customers : CustomerID [ INTEGER ] primary_key First [ TEXT ] Last [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] Email [ TEXT ] PhoneNumber [ TEXT ] FirstPurchaseDate [ DATE ] SubscribedToEmailList [ TEXT ] Gender [ TEXT ] rootbeerreview : CustomerID ...
SELECT T1.FirstPurchaseDate FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Review = 'Tastes like Australia.';
[INST] Please write me a SQL statement that answers the following question: When did Natalie Dorris buy her first root beer? [/INST] [/INST]
SELECT T2.TransactionDate FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Natalie' AND T1.Last = 'Dorris' ORDER BY T2.TransactionDate LIMIT 1;
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT T1.BreweryName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 GROUP BY T1.BrandID ORDER BY COUNT(T2.StarRating) DESC LIMIT 1;
[INST] Here is a database schema: customers : CustomerID [ INTEGER ] primary_key First [ TEXT ] Last [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] Email [ TEXT ] PhoneNumber [ TEXT ] FirstPurchaseDate [ DATE ] SubscribedToEmailList [ TEXT ] Gender [ TEXT ] rootbeerbrand : BrandID [ IN...
SELECT CASE WHEN T1.SubscribedToEmailList LIKE 'TRUE' THEN 'YES' ELSE 'NO' END AS result FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T2.BrandID = T3.BrandID WHERE T2.StarRating = 3 AND T3.BrandName = 'Frostie' AND T2.ReviewDate = '2014-04-24';
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT T1.CurrentRetailPrice - T1.WholesaleCost AS price FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.Review = 'The quintessential dessert root beer. No ice cream required.';
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT CAST(COUNT(CASE WHEN T2.StarRating = 5 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T2.StarRating) FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.BrandName = 'River City';
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT CAST(COUNT(*) AS REAL) / COUNT(DISTINCT T1.BrandID) AS avgreview FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T1.State = 'CA';
[INST] Here is a database schema: customers : CustomerID [ INTEGER ] primary_key First [ TEXT ] Last [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] Email [ TEXT ] PhoneNumber [ TEXT ] FirstPurchaseDate [ DATE ] SubscribedToEmailList [ TEXT ] Gender [ TEXT ] Please write me a SQL state...
SELECT COUNT(CustomerID) FROM customers WHERE Gender = 'F' AND SubscribedToEmailList = 'TRUE';
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT BrandName FROM rootbeerbrand ORDER BY FirstBrewedYear DESC LIMIT 1;
[INST] Here is a database schema: customers : CustomerID [ INTEGER ] primary_key First [ TEXT ] Last [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] Email [ TEXT ] PhoneNumber [ TEXT ] FirstPurchaseDate [ DATE ] SubscribedToEmailList [ TEXT ] Gender [ TEXT ] Please write me a SQL state...
SELECT First, Last FROM customers ORDER BY FirstPurchaseDate LIMIT 10;
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT COUNT(BreweryName) FROM rootbeerbrand WHERE Country = 'Australia';
[INST] Here is a database schema: customers : CustomerID [ INTEGER ] primary_key First [ TEXT ] Last [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] Email [ TEXT ] PhoneNumber [ TEXT ] FirstPurchaseDate [ DATE ] SubscribedToEmailList [ TEXT ] Gender [ TEXT ] Please write me a SQL state...
SELECT COUNT(CustomerID) FROM customers WHERE First = 'Charles' AND City = 'Sacramento';
[INST] Please write me a SQL statement that answers the following question: How many transactions were paid through MasterCard in 2014? [/INST] [/INST]
SELECT COUNT(TransactionID) FROM `transaction` WHERE CreditCardType = 'MasterCard' AND TransactionDate LIKE '2014%';
[INST] Here is a database schema: customers : CustomerID [ INTEGER ] primary_key First [ TEXT ] Last [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] Email [ TEXT ] PhoneNumber [ TEXT ] FirstPurchaseDate [ DATE ] SubscribedToEmailList [ TEXT ] Gender [ TEXT ] rootbeerbrand : BrandID [ IN...
SELECT T3.BrandName FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T2.BrandID = T3.BrandID WHERE T1.First = 'Jayne' AND T1.Last = 'Collins' AND T2.StarRating = 1;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key location.LocationID = geolocation.LocationID LocationName [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] Brewer...
SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN location AS T3 ON T1.LocationID = T3.LocationID WHERE T3.LocationName = 'Sac State American River Courtyard' AND T1.PurchaseDate LIKE '2015%' AND T2.Honey = 'TRUE' AND T2.CaneSugar = 'FALSE' AND T1.Containe...
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT T2.BreweryName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T1.PurchaseDate BETWEEN '2016-01-01' AND '2016-12-31' GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1;
[INST] Here is a database schema: customers : CustomerID [ INTEGER ] primary_key First [ TEXT ] Last [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] Email [ TEXT ] PhoneNumber [ TEXT ] FirstPurchaseDate [ DATE ] SubscribedToEmailList [ TEXT ] Gender [ TEXT ] rootbeerbrand : BrandID [ IN...
SELECT T1.First, T1.Last FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeerbrand AS T3 ON T2.BrandID = T3.BrandID WHERE T3.BrandName = 'River City' AND T2.StarRating = 5;
[INST] Please write me a SQL statement that answers the following question: How many root beers did Tom Hanks purchase between 2015 to 2016? [/INST] [/INST]
SELECT COUNT(T2.RootBeerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T1.First = 'Tom' AND T1.Last = 'Hanks' AND T2.TransactionDate BETWEEN '2015-01-01' AND '2016-12-31';
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5;
[INST] Please write me a SQL statement that answers the following question: How many Henry Weinhard's were bought by Nicholas Sparks? [/INST] [/INST]
SELECT COUNT(T1.CustomerID) FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID INNER JOIN rootbeer AS T3 ON T2.RootBeerID = T3.RootBeerID INNER JOIN rootbeerbrand AS T4 ON T3.BrandID = T4.BrandID WHERE T1.First = 'Nicholas' AND T1.Last = 'Sparks' AND T4.BrandName LIKE 'Henry Weinhard%s...
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT T2.BreweryName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T2.FacebookPage IS NULL AND T2.Twitter IS NULL GROUP BY T2.BrandID ORDER BY COUNT(T1.BrandID) DESC LIMIT 1;
[INST] Here is a database schema: location : LocationID [ INTEGER ] primary_key location.LocationID = geolocation.LocationID LocationName [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] Brewer...
SELECT T3.LocationName FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID INNER JOIN location AS T3 ON T1.LocationID = T3.LocationID WHERE T2.BrandName = 'Dog n Suds' AND T3.LocationName IN ('Sac State American River Courtyard', 'Sac State Union') GROUP BY T1.LocationID ORDER BY COUNT(T1.Bran...
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT COUNT(T1.BrandID) FROM rootbeer AS T1 INNER JOIN rootbeerbrand AS T2 ON T1.BrandID = T2.BrandID WHERE T1.ContainerType = 'Can' AND T2.BrandName = 'A&W' AND T1.PurchaseDate LIKE '2016%';
[INST] Here is a database schema: geolocation : LocationID [ INTEGER ] primary_key geolocation.LocationID = location.LocationID Latitude [ REAL ] Longitude [ REAL ] location : LocationID [ INTEGER ] primary_key location.LocationID = geolocation.LocationID LocationName [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State...
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';
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5 GROUP BY T2.BrandID HAVING COUNT(T2.StarRating) >= 5;
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT T1.BrandName , CAST(SUM(CASE WHEN T2.PurchaseDate >= '2014-01-01' AND T2.PurchaseDate <= '2016-12-31' THEN 1 ELSE 0 END) AS REAL) / COUNT(T2.BrandID) AS purchase FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID WHERE T1.BreweryName = 'Dr Pepper Snapple Group' GROUP BY T2.BrandID;
[INST] Please write me a SQL statement that answers the following question: Which brand of root beer has the lowest unit profit available to wholesalers? Indicate the ID of the customer that has the highest number of purchases of the said brand. [/INST] [/INST]
SELECT T3.BrandName, T2.CustomerID FROM rootbeer AS T1 INNER JOIN `transaction` AS T2 ON T1.RootBeerID = T2.RootBeerID INNER JOIN rootbeerbrand AS T3 ON T1.BrandID = T3.BrandID GROUP BY T3.BrandID ORDER BY T3.CurrentRetailPrice - T3.WholesaleCost, COUNT(T1.BrandID) DESC LIMIT 1;
[INST] Here is a database schema: customers : CustomerID [ INTEGER ] primary_key First [ TEXT ] Last [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] Email [ TEXT ] PhoneNumber [ TEXT ] FirstPurchaseDate [ DATE ] SubscribedToEmailList [ TEXT ] Gender [ TEXT ] Please write me a SQL state...
SELECT First, Last, PhoneNumber FROM customers WHERE Gender = 'M' AND City = 'Fair Oaks' AND SubscribedToEmailList = 'TRUE';
[INST] Here is a database schema: rootbeer : RootBeerID [ INTEGER ] primary_key BrandID [ INTEGER ] rootbeer.BrandID = rootbeerbrand.BrandID ContainerType [ TEXT ] LocationID [ INTEGER ] rootbeer.LocationID = geolocation.LocationID PurchaseDate [ DATE ] Please write me a SQL statement that answers the following questi...
SELECT CAST(COUNT(CASE WHEN ContainerType = 'Can' THEN RootBeerID ELSE NULL END) AS REAL) * 100 / COUNT(RootBeerID) FROM rootbeer WHERE PurchaseDate LIKE '2014%';
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT BrandName FROM rootbeerbrand WHERE FirstBrewedYear BETWEEN '1996' AND '2000' ORDER BY FirstBrewedYear DESC;
[INST] Here is a database schema: rootbeerreview : CustomerID [ INTEGER ] rootbeerreview.CustomerID = customers.CustomerID BrandID [ INTEGER ] rootbeerreview.BrandID = rootbeerbrand.BrandID StarRating [ INTEGER ] ReviewDate [ DATE ] Review [ TEXT ] Please write me a SQL statement that answers the following question: F...
SELECT BrandID FROM rootbeerreview WHERE StarRating = 1 GROUP BY BrandID ORDER BY COUNT(BrandID) DESC LIMIT 1;
[INST] Please write me a SQL statement that answers the following question: Among the transactions, what percentage is done by using a visa card? [/INST] [/INST]
SELECT CAST(COUNT(CASE WHEN CreditCardType = 'Visa' THEN TransactionID ELSE NULL END) AS REAL) * 100 / COUNT(TransactionID) FROM `transaction`;
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
SELECT COUNT(BrandID) FROM rootbeerbrand WHERE CornSyrup = 'TRUE' AND ArtificialSweetener = 'TRUE' AND AvailableInCans = 'TRUE';
[INST] Please write me a SQL statement that answers the following question: Calculate the percentage of sales done at Sac State American River Courtyard. [/INST] [/INST]
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;
[INST] Please write me a SQL statement that answers the following question: On average how many caffeinated root beers are sold a day? [/INST] [/INST]
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';
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
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.Br...
[INST] Please write me a SQL statement that answers the following question: What is the average cost of root beers purchased for more than 2 dollars and sold in bottles? [/INST] [/INST]
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;
[INST] Please write me a SQL statement that answers the following question: Among the root beers sold in bottles, how many are sold at the location 38.559615, -121.42243? [/INST] [/INST]
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...
[INST] Here is a database schema: customers : CustomerID [ INTEGER ] primary_key First [ TEXT ] Last [ TEXT ] StreetAddress [ TEXT ] City [ TEXT ] State [ TEXT ] ZipCode [ INTEGER ] Email [ TEXT ] PhoneNumber [ TEXT ] FirstPurchaseDate [ DATE ] SubscribedToEmailList [ TEXT ] Gender [ TEXT ] rootbeerreview : CustomerID ...
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';
[INST] Here is a database schema: rootbeerbrand : BrandID [ INTEGER ] primary_key BrandName [ TEXT ] FirstBrewedYear [ INTEGER ] BreweryName [ TEXT ] City [ TEXT ] State [ TEXT ] Country [ TEXT ] Description [ TEXT ] CaneSugar [ TEXT ] CornSyrup [ TEXT ] Honey [ TEXT ] ArtificialSweetener [ TEXT ] Caffeinated [ TEXT ] ...
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;
[INST] Please write me a SQL statement that answers the following question: In the female customers, how many bought root beer that contains artificial sweetener? [/INST] [/INST]
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';