1sf/bird-sql-train-with-schema huggingface dataset:
Database: address
Tables: CBSA, state, congress, zip_data, alias, area_code, avoid, country, zip_congress
Columns (table index, column name): -1, *, 0, CBSA, 0, CBSA_name, 0, CBSA_type, 1, abbreviation, 1, name, 2, cognress_rep_id, 2, first_name, 2, last_name, 2, CID, 2, party, 2, state, 2, abbreviation, 2, House, 2, District, 2, land_area, 3, zip_code, 3, city, 3, state, 3, multi_county, 3, type, 3, organization, 3, time_zone, 3, daylight_savings, 3, latitude, 3, longitude, 3, elevation, 3, state_fips, 3, county_fips, 3, region, 3, division, 3, population_2020, 3, population_2010, 3, households, 3, avg_house_value, 3, avg_income_per_household, 3, persons_per_household, 3, white_population, 3, black_population, 3, hispanic_population, 3, asian_population, 3, american_indian_population, 3, hawaiian_population, 3, other_population, 3, male_population, 3, female_population, 3, median_age, 3, male_median_age, 3, female_median_age, 3, residential_mailboxes, 3, business_mailboxes, 3, total_delivery_receptacles, 3, businesses, 3, 1st_quarter_payroll, 3, annual_payroll, 3, employees, 3, water_area, 3, land_area, 3, single_family_delivery_units, 3, multi_family_delivery_units, 3, total_beneficiaries, 3, retired_workers, 3, disabled_workers, 3, parents_and_widowed, 3, spouses, 3, children, 3, over_65, 3, monthly_benefits_all, 3, monthly_benefits_retired_workers, 3, monthly_benefits_widowed, 3, CBSA, 4, zip_code, 4, alias, 5, zip_code, 5, area_code, 6, zip_code, 6, bad_alias, 7, zip_code, 7, county, 7, state, 8, zip_code, 8, district
Question: Who is the CBSA officer of the post point in the area with the highest number of employees?
Evidence: CBSA officer refers to CBSA_name; the highest number of employees refers to MAX(employees);
SQL: 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 )
Database: address
Tables: CBSA, state, congress, zip_data, alias, area_code, avoid, country, zip_congress
Columns (table index, column name): -1, *, 0, CBSA, 0, CBSA_name, 0, CBSA_type, 1, abbreviation, 1, name, 2, cognress_rep_id, 2, first_name, 2, last_name, 2, CID, 2, party, 2, state, 2, abbreviation, 2, House, 2, District, 2, land_area, 3, zip_code, 3, city, 3, state, 3, multi_county, 3, type, 3, organization, 3, time_zone, 3, daylight_savings, 3, latitude, 3, longitude, 3, elevation, 3, state_fips, 3, county_fips, 3, region, 3, division, 3, population_2020, 3, population_2010, 3, households, 3, avg_house_value, 3, avg_income_per_household, 3, persons_per_household, 3, white_population, 3, black_population, 3, hispanic_population, 3, asian_population, 3, american_indian_population, 3, hawaiian_population, 3, other_population, 3, male_population, 3, female_population, 3, median_age, 3, male_median_age, 3, female_median_age, 3, residential_mailboxes, 3, business_mailboxes, 3, total_delivery_receptacles, 3, businesses, 3, 1st_quarter_payroll, 3, annual_payroll, 3, employees, 3, water_area, 3, land_area, 3, single_family_delivery_units, 3, multi_family_delivery_units, 3, total_beneficiaries, 3, retired_workers, 3, disabled_workers, 3, parents_and_widowed, 3, spouses, 3, children, 3, over_65, 3, monthly_benefits_all, 3, monthly_benefits_retired_workers, 3, monthly_benefits_widowed, 3, CBSA, 4, zip_code, 4, alias, 5, zip_code, 5, area_code, 6, zip_code, 6, bad_alias, 7, zip_code, 7, county, 7, state, 8, zip_code, 8, district
Question: How many postal points with unique post office types are there in Ohio?
Evidence: postal points refer to zip_code; unique post office types refer to type = 'Unique Post Office'; Ohio is the name of the state, in which name = 'Ohio';
SQL: 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'
Database: address
Tables: CBSA, state, congress, zip_data, alias, area_code, avoid, country, zip_congress
Columns (table index, column name): -1, *, 0, CBSA, 0, CBSA_name, 0, CBSA_type, 1, abbreviation, 1, name, 2, cognress_rep_id, 2, first_name, 2, last_name, 2, CID, 2, party, 2, state, 2, abbreviation, 2, House, 2, District, 2, land_area, 3, zip_code, 3, city, 3, state, 3, multi_county, 3, type, 3, organization, 3, time_zone, 3, daylight_savings, 3, latitude, 3, longitude, 3, elevation, 3, state_fips, 3, county_fips, 3, region, 3, division, 3, population_2020, 3, population_2010, 3, households, 3, avg_house_value, 3, avg_income_per_household, 3, persons_per_household, 3, white_population, 3, black_population, 3, hispanic_population, 3, asian_population, 3, american_indian_population, 3, hawaiian_population, 3, other_population, 3, male_population, 3, female_population, 3, median_age, 3, male_median_age, 3, female_median_age, 3, residential_mailboxes, 3, business_mailboxes, 3, total_delivery_receptacles, 3, businesses, 3, 1st_quarter_payroll, 3, annual_payroll, 3, employees, 3, water_area, 3, land_area, 3, single_family_delivery_units, 3, multi_family_delivery_units, 3, total_beneficiaries, 3, retired_workers, 3, disabled_workers, 3, parents_and_widowed, 3, spouses, 3, children, 3, over_65, 3, monthly_benefits_all, 3, monthly_benefits_retired_workers, 3, monthly_benefits_widowed, 3, CBSA, 4, zip_code, 4, alias, 5, zip_code, 5, area_code, 6, zip_code, 6, bad_alias, 7, zip_code, 7, county, 7, state, 8, zip_code, 8, district
Question: Calculate the average number of beneficiaries per postal point in Guam.
Evidence: DIVIDE(SUM(total_beneficiaries), COUNT(zip_code)) where name = 'Guam';
SQL: 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'
Database: address
Tables: CBSA, state, congress, zip_data, alias, area_code, avoid, country, zip_congress
Columns (table index, column name): -1, *, 0, CBSA, 0, CBSA_name, 0, CBSA_type, 1, abbreviation, 1, name, 2, cognress_rep_id, 2, first_name, 2, last_name, 2, CID, 2, party, 2, state, 2, abbreviation, 2, House, 2, District, 2, land_area, 3, zip_code, 3, city, 3, state, 3, multi_county, 3, type, 3, organization, 3, time_zone, 3, daylight_savings, 3, latitude, 3, longitude, 3, elevation, 3, state_fips, 3, county_fips, 3, region, 3, division, 3, population_2020, 3, population_2010, 3, households, 3, avg_house_value, 3, avg_income_per_household, 3, persons_per_household, 3, white_population, 3, black_population, 3, hispanic_population, 3, asian_population, 3, american_indian_population, 3, hawaiian_population, 3, other_population, 3, male_population, 3, female_population, 3, median_age, 3, male_median_age, 3, female_median_age, 3, residential_mailboxes, 3, business_mailboxes, 3, total_delivery_receptacles, 3, businesses, 3, 1st_quarter_payroll, 3, annual_payroll, 3, employees, 3, water_area, 3, land_area, 3, single_family_delivery_units, 3, multi_family_delivery_units, 3, total_beneficiaries, 3, retired_workers, 3, disabled_workers, 3, parents_and_widowed, 3, spouses, 3, children, 3, over_65, 3, monthly_benefits_all, 3, monthly_benefits_retired_workers, 3, monthly_benefits_widowed, 3, CBSA, 4, zip_code, 4, alias, 5, zip_code, 5, area_code, 6, zip_code, 6, bad_alias, 7, zip_code, 7, county, 7, state, 8, zip_code, 8, district
Question: Calculate the percentage of congress representatives from the Democrat party. Among them, how many postal points are in the Hawaii state?
Evidence: DIVIDE(COUNT(party = 'Democrat'), COUNT(congress_rep_id)) as percentage; postal points refer to zip_code; state = 'Hawaii';
SQL: 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
Database: beer_factory
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
Question: What is the name of the root beer brand that has the longest history?
Evidence: name of the root beer brand refers to BrandName; longest history refers to MIN(FirstBrewedYear);
SQL: SELECT BrandName FROM rootbeerbrand WHERE FirstBrewedYear = ( SELECT MIN(FirstBrewedYear) FROM rootbeerbrand )
Database: beer_factory
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
Question: How many breweries are located in North America?
Evidence: North America refers to country = 'United States'; North America is the name of continent where country = 'United States' is located;
SQL: SELECT COUNT(BrandID) FROM rootbeerbrand WHERE Country = 'United States'
Database: beer_factory
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
Question: Please list the names of all the root beer brands that are advertised on facebook.
Evidence: name of the root beer brand refers to BrandName; advertised on facebook refers to FacebookPage IS not NULL;
SQL: SELECT BrandName FROM rootbeerbrand WHERE FacebookPage IS NOT NULL
Database: beer_factory
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
Question: What is the name of the root beer brand with the lowest unit profit available to wholesalers?
Evidence: name of the root beer brand refers to BrandName; lowest unit profit available to wholesalers refers to MIN(SUBTRACT(CurrentRetailPrice, WholesaleCost));
SQL: SELECT BrandName FROM rootbeerbrand ORDER BY CurrentRetailPrice - WholesaleCost LIMIT 1
Database: beer_factory
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
Question: What is the description of the root beer brand A&W?
Evidence: A&W refers to BrandName = 'A&W';
SQL: SELECT Description FROM rootbeerbrand WHERE BrandName = 'A&W'
Database: beer_factory
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
Question: In which city is the brewery AJ Stephans Beverages located?
Evidence: AJ Stephans refers to BreweryName = 'AJ Stephans Beverages';
SQL: SELECT City FROM rootbeerbrand WHERE BreweryName = 'AJ Stephans Beverages'
Database: beer_factory
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
Question: How many transactions had Frank-Paul Santangelo made in July, 2014?
Evidence: in July, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '07';
SQL: 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'
Database: beer_factory
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
Question: Among the transactions made in July, 2014, how many of them were made by a male customer?
Evidence: in July, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '07'; male customer refers to Gender = 'M';
SQL: 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'
Database: beer_factory
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
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?
Evidence: users permit the company to send regular emails to them refers to subscribedtoemaillist = 'TRUE'; Visa card refers to creditcardtype = 'Visa'; in July, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '07';
SQL: 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'
Database: beer_factory
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
Question: What is the full name of the customer that had made the most transactions in August, 2014?
Evidence: full name = First, Last; made the most transactions refers to MAX(COUNT(TransactionID)); in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';
SQL: 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
Database: beer_factory
Tables: customers, geolocation, location, rootbeerbrand, rootbeer, rootbeerreview, transaction
Columns (table index, column name): -1, *, 0, CustomerID, 0, First, 0, Last, 0, StreetAddress, 0, City, 0, State, 0, ZipCode, 0, Email, 0, PhoneNumber, 0, FirstPurchaseDate, 0, SubscribedToEmailList, 0, Gender, 1, LocationID, 1, Latitude, 1, Longitude, 2, LocationID, 2, LocationName, 2, StreetAddress, 2, City, 2, State, 2, ZipCode, 3, BrandID, 3, BrandName, 3, FirstBrewedYear, 3, BreweryName, 3, City, 3, State, 3, Country, 3, Description, 3, CaneSugar, 3, CornSyrup, 3, Honey, 3, ArtificialSweetener, 3, Caffeinated, 3, Alcoholic, 3, AvailableInCans, 3, AvailableInBottles, 3, AvailableInKegs, 3, Website, 3, FacebookPage, 3, Twitter, 3, WholesaleCost, 3, CurrentRetailPrice, 4, RootBeerID, 4, BrandID, 4, ContainerType, 4, LocationID, 4, PurchaseDate, 5, CustomerID, 5, BrandID, 5, StarRating, 5, ReviewDate, 5, Review, 6, TransactionID, 6, CreditCardNumber, 6, CustomerID, 6, TransactionDate, 6, CreditCardType, 6, LocationID, 6, RootBeerID, 6, PurchasePrice
Question: Please list the brands of all the root beer that Frank-Paul Santangelo had purchased on 2014/7/7.
Evidence: brands of the root beer refers to BrandName; purchased on 2014/7/7 refers to transactiondate = '2014-07-07';
SQL: 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-07-07'