db_id
stringclasses
69 values
question
stringlengths
24
325
evidence
stringlengths
1
673
SQL
stringlengths
23
804
schema
stringclasses
69 values
address
Indicate the name of the country with a population greater than 10000 in 2010.
population greater than 10000 in 2010 refers to population_2010 > 10000;
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
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Name the country with the largest number of households in a residential area.
the largest number of households refers to MAX(households);
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
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Calculate the percentage of households in residential areas of countries over 10000.
DIVIDE(SUM(households > 10000), SUM(households)) as percentage;
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
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Among the types of postal points in Saint Croix, what percentage of postal points is the post office?
DIVIDE(COUNT(type = 'Post Office' ), COUNT(type)) as percentage where county = 'SAINT CROIX';
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Among the area code 787, list the country of the cities with a postal point type of unique postal office.
postal point type of unique postal office refers to type = 'Unique Post Office';
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
What is the elevation of the city with the alias East Longmeadow?
null
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
In cities that do not implement daylight savings, what is the total number of cities?
do not implement daylight savings refers to daylight_savings = 'No';
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Give the country and area code of the city with zip code 1116.
null
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
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Among the cities with alias St Thomas, provide the type of postal point for each city.
null
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
List down the names of the cities belonging to Noble, Oklahoma.
the county of Noble is located in the state of Oklahoma;
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Among the listed cities, provide the area code of the city with the largest water area.
the largest water area refers to MAX(water_area);
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 )
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Provide the alias of the city with the highest population in year 2020.
the highest population in year 2020 refers to MAX(population_2020);
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 )
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
What is the elevation of the city belonging to Hampden, Massachusetts?
the county of Hampden is located in the state of Massachusetts.
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
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
List the area code of the city with the highest Hispanic population.
the highest Hispanic population refers to MAX(hispanic_population);
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 )
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Give the alias of the cities with an Asian population of 7.
Asian population of 7 refers to asian_population = 7;
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
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
What is the average of the white population in the cities with area code 920?
AVG(white_population) where area_code = 920;
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
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Among the cities with alias Ponce, what is the percentage of cities with a country level FIPS code of less than 20?
DIVIDE(COUNT(county_fips < 20), COUNT(county_fips)) as percentage where alias = 'Ponce';
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
List down the country of the cities with a population greater than 97% of the average population of all countries in 2020.
population_2020 > MULTIPLY(0.97, AVG(population_2020));
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 )
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Count the number of postal points in the district represented by Kirkpatrick Ann.
postal points refer to zip_code;
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Provide the zip codes and coordinates of the postal points under Allentown-Bethlehem-Easton, PA-NJ.
coordinates refer to latitude and longitude; under Allentown-Bethlehem-Easton, PA-NJ refers to CBSA_name = 'Allentown-Bethlehem-Easton, PA-NJ';
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Provide the zip codes, cities, and locations of the postal points that have Shared Reshipper as a bad alias.
latitude and longitude coordinates can be used to identify the location;
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Who are the congress representatives of the postal points in Garfield?
Who are the congress representatives refer to first_name, last_name; Garfield is the city;
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Count the number of postal points under New York-Newark-Jersey City, NY-NJ-PA.
postal points refer to zip_code; under New York-Newark-Jersey City, NY-NJ-PA refers to CBSA_name = 'New York-Newark-Jersey City, NY-NJ-PA';
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
How many postal points are there under the congress representative in Puerto Rico?
postal points refer to zip_code; Puerto Rico refers to state = 'Puerto Rico';
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Describe the number of postal points and the countries in West Virginia.
postal points refer to zip_code; West Virginia is the name of the state, in which name = 'West Virginia';
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Provide the zip codes and area codes of the postal points with the community post office type at the elevation above 6000.
community post office type refers to type = 'Community Post Office'; elevation above 6000 refers to elevation > 6000;
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
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
How many postal points are there under the congress representative from the House of Representatives in Mississippi?
postal points refer to zip_code; Mississippi is the name of the state, in which name = 'Mississippi';
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Provide the congress representatives' IDs of the postal points in East Springfield.
congress representatives' IDs refer to CID; East Springfield is the city;
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'
database name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Who is the CBSA officer of the post point in the area with the highest number of employees?
CBSA officer refers to CBSA_name; the highest number of employees refers to MAX(employees);
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 name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
How many postal points with unique post office types are there in Ohio?
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';
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 name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Calculate the average number of beneficiaries per postal point in Guam.
DIVIDE(SUM(total_beneficiaries), COUNT(zip_code)) where name = 'Guam';
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 name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
address
Calculate the percentage of congress representatives from the Democrat party. Among them, how many postal points are in the Hawaii state?
DIVIDE(COUNT(party = 'Democrat'), COUNT(congress_rep_id)) as percentage; postal points refer to zip_code; state = 'Hawaii';
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 name:db_id address CBSA table CBSA Cols: CBSA dtype integer, cbsa name dtype text, cbsa type dtype text, state table state Cols: abbreviation dtype text, name dtype text, congress table congress Cols: congress representative id dtype text, first name dtype text, last name dtype text, CID dtype text, party dtype text, state dtype text, abbreviation dtype text, House dtype text, District dtype integer, land area dtype real, zip_data table zip_data Cols: zip code dtype integer, city dtype text, state dtype text, multi country dtype text, type dtype text, organization dtype text, time zone dtype text, daylight savings dtype text, latitude dtype real, longitude dtype real, elevation dtype integer, state fips dtype integer, country fips dtype integer, region dtype text, division dtype text, population 2020 dtype integer, population 2010 dtype integer, households dtype integer, average house value dtype integer, average income per household dtype integer, persons per household dtype real, white population dtype integer, black population dtype integer, Hispanic population dtype integer, Asian population dtype integer, American Indian population dtype integer, Hawaiian population dtype integer, other population dtype integer, male population dtype integer, female population dtype integer, median age dtype real, male median age dtype real, female median age dtype real, residential mailboxes dtype integer, business mailboxes dtype integer, total delivery receptacles dtype integer, businesses dtype integer, 1st quarter payroll dtype integer, annual payroll dtype integer, employees dtype integer, water area dtype real, land area dtype real, single-family delivery units dtype integer, multi-family delivery units dtype integer, total beneficiaries dtype integer, retired workers dtype integer, disable workers dtype integer, parents and widowed dtype integer, spouses dtype integer, children dtype integer, over 65 dtype integer, monthly benefits all dtype integer, monthly benefits retired workers dtype integer, monthly benefits widowed dtype integer, CBSA dtype integer, alias table alias Cols: zip code dtype integer, alias dtype text, area_code table area_code Cols: zip code dtype integer, area code dtype integer, avoid table avoid Cols: zip code dtype integer, bad alias dtype text, country table country Cols: zip code dtype integer, country dtype text, state dtype text, zip_congress table zip_congress Cols: zip code dtype integer, district dtype text,
beer_factory
What is the name of the root beer brand that has the longest history?
name of the root beer brand refers to BrandName; longest history refers to MIN(FirstBrewedYear);
SELECT BrandName FROM rootbeerbrand WHERE FirstBrewedYear = ( SELECT MIN(FirstBrewedYear) FROM rootbeerbrand )
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
How many breweries are located in North America?
North America refers to country = 'United States'; North America is the name of continent where country = 'United States' is located;
SELECT COUNT(BrandID) FROM rootbeerbrand WHERE Country = 'United States'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Please list the names of all the root beer brands that are advertised on facebook.
name of the root beer brand refers to BrandName; advertised on facebook refers to FacebookPage IS not NULL;
SELECT BrandName FROM rootbeerbrand WHERE FacebookPage IS NOT NULL
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What is the name of the root beer brand with the lowest unit profit available to wholesalers?
name of the root beer brand refers to BrandName; lowest unit profit available to wholesalers refers to MIN(SUBTRACT(CurrentRetailPrice, WholesaleCost));
SELECT BrandName FROM rootbeerbrand ORDER BY CurrentRetailPrice - WholesaleCost LIMIT 1
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What is the description of the root beer brand A&W?
A&W refers to BrandName = 'A&W';
SELECT Description FROM rootbeerbrand WHERE BrandName = 'A&W'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
In which city is the brewery AJ Stephans Beverages located?
AJ Stephans refers to BreweryName = 'AJ Stephans Beverages';
SELECT City FROM rootbeerbrand WHERE BreweryName = 'AJ Stephans Beverages'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
How many transactions had Frank-Paul Santangelo made in July, 2014?
in July, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '07';
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 name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Among the transactions made in July, 2014, how many of them were made by a male customer?
in July, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '07'; male customer refers to Gender = 'M';
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 name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
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?
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';
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 name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What is the full name of the customer that had made the most transactions in August, 2014?
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';
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 name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Please list the brands of all the root beer that Frank-Paul Santangelo had purchased on 2014/7/7.
brands of the root beer refers to BrandName; purchased on 2014/7/7 refers to transactiondate = '2014-07-07';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Of the 4 root beers that Frank-Paul Santangelo purchased on 2014/7/7, how many of them were in cans?
on 2014/7/7 refers to transactiondate = '2014-07-07'; in cans refers to containertype = 'Can';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
How many root beers of the Bulldog were purchased in August, 2014?
Bulldog refers to BrandName = 'Bulldog'; purchased in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Please list the full names of the customers who have purchased at least one root beer produced by AJ Stephans Beverages.
full name = First, Last; customers who have purchased at least one root beer refers to CustomerID > = 1; produced by AJ Stephans Beverages refers to BreweryName = 'AJ Stephans Beverages';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Among the root beer brands that do not advertise on Twitter, how many of them have root beers sold in August, 2014?
do not advertise on Twitter refers to twitter IS NULL; in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What is the number of the credit card that Frank-Paul Santangelo used to purchase root beers on 2014/7/7?
number of the credit card refers to CreditCardNumber; on 2014/7/7 refers to TransactionDate = '2014-07-07';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Among all the root beers purchased by Frank-Paul Santangelo, how many of them were non-sweetened?
non-sweetened refers to honey = 'FALSE' AND artificialsweetener = 'FALSE';
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 = 'FALSE' AND T4.Honey = 'FALSE'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Please list the dates on which a male customer has purchased more than 3 root beers.
dates of purchase refers to TransactionDate; male customer refers to Gender = 'M'; purchased more than 3 root beers refers to COUNT(CustomerID) > 3;
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What is the average number of root beers of the brand A&W sold in a day in August, 2014?
average = DIVIDE(SUM(COUNT(RootBeerID WHERE BrandName = 'A&W' AND SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08')), 31); A&W refers to BrandName = 'A&W'; in August, 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014' AND SUBSTR(TransactionDate, 6, 2) = '08';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Among all the root beers sold in 2014, what is the percentage of the root beers produced by the brewery AJ Stephans Beverages?
sold in 2014 refers to SUBSTR(TransactionDate, 1, 4) = '2014'; percentage = DIVIDE(MULTIPLY(SUM(BreweryName = 'AJ Stephans Beverages'), 1.0), COUNT(RootBeerID)) WHERE SUBSTR(TransactionDate, 1, 4) = '2014'; AJ Stephans Beverages refers to BreweryName = 'AJ Stephans Beverages';
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%'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Tell the number of reviews given by James House.
FALSE;
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Show the credit card number of Lisa Ling.
FALSE;
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
State the coordinate of Sac State American River Courtyard.
coordinate = Latitude, Longitude; Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Provide the name of the location where transaction no.100885 happened.
name of the location refers to LocationName; transaction no. refers to TransactionID; TransactionID = 100885;
SELECT T2.LocationName FROM `transaction` AS T1 INNER JOIN location AS T2 ON T1.LocationID = T2.LocationID WHERE T1.TransactionID = 100885
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Which city does the customer who finished transaction no.103545 live in?
transaction no. refers to TransactionID; TransactionID = 103545;
SELECT T1.City FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.TransactionID = 103545
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What is the phone number of the customer who owns the credit card of number 6011179359005380?
FALSE;
SELECT DISTINCT T1.PhoneNumber FROM customers AS T1 INNER JOIN `transaction` AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.CreditCardNumber = 6011179359005382
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Which customer has the most reviews? State the full name.
customer that has the most reviews refers to MAX(COUNT(CustomerID)); full name = First, Last;
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
For the customer who leaves the review content of "Tastes like Australia.", when was his/her first purchase date?
review content of "Tastes like Australia." refers to Review = 'Tastes like Australia.';
SELECT T1.FirstPurchaseDate FROM customers AS T1 INNER JOIN rootbeerreview AS T2 ON T1.CustomerID = T2.CustomerID WHERE T2.Review = 'Tastes like Australia.'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
When did Natalie Dorris buy her first root beer?
when a customer bought their first root beer refers to FirstPurchaseDate;
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
For the root beer brand with the most 5 star ratings, what is the name of the brewery?
most 5 star ratings refers to MAX(COUNT(StarRating = 5)); name of the brewery refers to BreweryName;
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
For the customer who gave a 3 star rating to Frostie brand on 2014/4/24, did the user permit the company to send regular emails to him/her?
3 star rating refers to StarRating = 3; Frostie refers to  BrandName = 'Frostie'; if SubscribedToEmailList = 'TRUE', it means the user permit the company to send regular emails to him/her; if SubscribedToEmailList = FALSE', it means the user did not permit the company to send regular emails to him/her; rating on 2014/4/24 refers to ReviewDate = '2014-04-24';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
For the root beer brand which got the review with the content of "The quintessential dessert root beer. No ice cream required.", what is the current retail price of the root beer?
review with the content of "The quintessential dessert root beer. No ice cream required." refers to Review = 'The quintessential dessert root beer. No ice cream required.';
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.'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What is the percentage of 5 star ratings River City brand root beer get?
percentage = MULTIPLY(DIVIDE(SUM(BrandID WHERE StarRating = 5), COUNT(BrandID) WHERE BrandName = 'River City'), 1.0); 5 star ratings refers to StarRating = 5; River City refers to BrandName = 'River City';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What is the average number of reviews of all the root beer brands from "CA" State?
average = DIVIDE(COUNT(CustomerID), COUNT(BrandID) WHERE state = CA);
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
How many female customers permit the company to send regular emails to them?
female refers to Gender = 'F'; customer permits the company to send regular emails to them refers to SubscribedToEmailList = 'TRUE';
SELECT COUNT(CustomerID) FROM customers WHERE Gender = 'F' AND SubscribedToEmailList = 'TRUE'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What is the name of the brand of the beer with the shortest brewed history?
name of the brand of the beer refers to BrandName; shortest brewed history refers to MAX(FirstBrewedYear);
SELECT BrandName FROM rootbeerbrand ORDER BY FirstBrewedYear DESC LIMIT 1
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What are the full names of the first top 10 customers?
full name = First Last; first top 10 customers refers to MIN(FirstPurchaseDate) LIMIT 10;
SELECT First, Last FROM customers ORDER BY FirstPurchaseDate LIMIT 10
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
How many breweries are there in Australia?
Australia refers to Country = 'Australia';
SELECT COUNT(BreweryName) FROM rootbeerbrand WHERE Country = 'Australia'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
How many customers are named Charles in Sacramento?
Sacramento refers to City = 'Sacramento';
SELECT COUNT(CustomerID) FROM customers WHERE First = 'Charles' AND City = 'Sacramento'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
How many transactions were paid through MasterCard in 2014?
MasterCard refers to CreditCardType = 'MasterCard'; in 2014 refers to TransactionDate > = '2014-01-01' AND TransactionDate < = '2014-12-31';
SELECT COUNT(TransactionID) FROM `transaction` WHERE CreditCardType = 'MasterCard' AND TransactionDate LIKE '2014%'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Which brand of root beer did Jayne Collins give the lowest rating?
brand of root beer refers to BrandName; lowest rating refers to MIN(StarRating);
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
How many sweet bottled root beers that do not contain cane sugar were purchased in 2015 through the selling company located in Sac State American River Courtyard?
sweet refers to Honey = 'TRUE'; bottled refers to ContainerType = 'Bottle'; do not contain cane sugar refers to CaneSugar = 'FALSE'; in 2015 refers to PurchaseDate < = '2015-12-31'; Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard';
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.ContainerType = 'Bottle'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Which brewery does the most purchased root beer in 2016 belong to?
most purchased root beer refers to MAX(COUNT(BrandID)); in 2016 refers to PurchaseDate > = '2016-01-01' AND PurchaseDate < = '2016-12-31';
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What are the full names of the customer who gave River City a 5-star?
full name = First, Last; River City refers to BrandName = 'River City'; 5-star refers to StarRating = 5;
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
How many root beers did Tom Hanks purchase between 2015 to 2016?
between 2015 to 2016 refers to TransactionDate > = '2015-01-01' AND TransactionDate < '2016-12-31';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Which brand of root beer was highly rated by customers?
brand of root beer refers to BrandName; highly rated refers to MAX(COUNT(StarRating = 5));
SELECT T1.BrandName FROM rootbeerbrand AS T1 INNER JOIN rootbeerreview AS T2 ON T1.BrandID = T2.BrandID WHERE T2.StarRating = 5
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
How many Henry Weinhard's were bought by Nicholas Sparks?
Henry Weinhard's refers to BrandName = 'Henry Weinhard''s';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Among the root beer brands that do not advertise on Facebook and Twitter, which brand has the highest number of purchases?
do not advertise on Facebook and Twitter refers to FacebookPage IS NULL AND Twitter IS NULL; highest number of purchases refers to MAX(COUNT(BrandID));
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Between Sac State Union and Sac State American River Courtyard, which location sold the most Dog n Suds root beer?
Between Sac State Union and Sac State American River Courtyard refers to LocationName IN('Sac State American River Courtyard', 'Sac State Union'); Dog n Suds refers to BrandName = 'Dog n Suds'; sold the most root beer refers to MAX(COUNT(BrandID));
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.BrandID) DESC LIMIT 1
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
How many canned A&W were purchased in 2016?
canned refers to ContainerType = 'Can'; A&W refers to BrandName = 'A&W'; in 2016 refers to PurchaseDate > = '2016-01-01' AND PurchaseDate < = '2016-12-31';
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%'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What is the precise location of Sac State Union?
precise location = Latitude, Longitude; Sac State Union refers to LocationName = 'Sac State Union';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What are the brands of the root beers that received 5-star ratings from no less than 5 customers?
brand of the root beer refers to BrandName; 5-star ratings refers to StarRating = 5; no less than 5 customers refers to COUNT(CustomerID) > = 5;
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
List the brands of root beer produced by Dr Pepper Snapple Group and calculate their percentage of purchases between 2014 to 2016.
brand of root beer refers to BrandName; produced by Dr Pepper Snapple Group refers to BreweryName = 'Dr Pepper Snapple Group'; percentage of purchases = MULTIPLY(DIVIDE(SUM(BrandID WHERE PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2016-12-31'), COUNT(BrandID) WHERE BreweryName = 'Dr Pepper Snapple Group'), 1.0); between 2014 to 2016 refers to PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2016-12-31;
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
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.
brand of root beer refers to BrandName; lowest unit profit available to wholesalers refers to MIN(SUBTRACT(CurrentRetailPrice, WholesaleCost)); ID of the customer refers to CustomerID; highest number of purchases refers to MAX(COUNT(CustomerID));
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
List the full name and phone number of male customers from Fair Oaks who are subscribed to the email list.
full name = First, Last; male customers refers to Gender = 'M'; Fair Oaks refers to City = 'Fair Oaks'; subscribed to the email list refers to SubscribedToEmailList = 'TRUE';
SELECT First, Last, PhoneNumber FROM customers WHERE Gender = 'M' AND City = 'Fair Oaks' AND SubscribedToEmailList = 'TRUE'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Among the root beer purchased in 2014, what percentage were sold in cans?
in 2014 refers to PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2014-12-31'; percentage = MULTIPLY(DIVIDE(SUM(ContainerType = 'Can'), COUNT(RootBeerID) WHERE PurchaseDate > = '2014-01-01' AND PurchaseDate < = '2014-12-31'), 1.0); in cans refers to ContainerType = 'Can';
SELECT CAST(COUNT(CASE WHEN ContainerType = 'Can' THEN RootBeerID ELSE NULL END) AS REAL) * 100 / COUNT(RootBeerID) FROM rootbeer WHERE PurchaseDate LIKE '2014%'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Give the name of the brands that brewed their first drink between 1996 and 2000 in the descending order of the date brewed.
name of the brands refers to BrandName; between 1996 and 2000 refers to FirstBrewedYear > = 1996 AND FirstBrewedYear < = 2000;
SELECT BrandName FROM rootbeerbrand WHERE FirstBrewedYear BETWEEN '1996' AND '2000' ORDER BY FirstBrewedYear DESC
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Find the brand Id of the root beer which has the most number of customers who gave 1-star ratings.
most number of customers who gave 1-star ratings refers to MAX(COUNT(StarRating = 1)); 1-star ratings refers to StarRating = 1;
SELECT BrandID FROM rootbeerreview WHERE StarRating = 1 GROUP BY BrandID ORDER BY COUNT(BrandID) DESC LIMIT 1
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Among the transactions, what percentage is done by using a visa card?
visa card refers to CreditCardType = 'Visa'; percentage = MULTIPLY(DIVIDE(SUM(CreditCardType = 'Visa'), COUNT(TransactionID)), 1.0);
SELECT CAST(COUNT(CASE WHEN CreditCardType = 'Visa' THEN TransactionID ELSE NULL END) AS REAL) * 100 / COUNT(TransactionID) FROM `transaction`
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
How many brands of root beers are available in cans and contain corn syrup and artificial sweeteners?
available in cans refers to AvailableInCans = 'TRUE'; contain corn syrup refers to CornSyrup = 'TRUE'; contain artificial sweeteners refers to ArtificialSweetener = 'TRUE';
SELECT COUNT(BrandID) FROM rootbeerbrand WHERE CornSyrup = 'TRUE' AND ArtificialSweetener = 'TRUE' AND AvailableInCans = 'TRUE'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Calculate the percentage of sales done at Sac State American River Courtyard.
percentage =   MULTIPLY(DIVIDE(SUM(LocationName = 'Sac State American River Courtyard'), COUNT(LocationID)), 1.0); Sac State American River Courtyard refers to LocationName = 'Sac State American River Courtyard';
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
On average how many caffeinated root beers are sold a day?
average = DIVIDE(COUNT(RootBeerID WHERE Caffeinated = 'TRUE'), COUNT(PurchaseDate)); caffeinated refers to Caffeinated = 'TRUE';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Find the root beer with the most and least amount of profit per unit and list the container types in which these root beers are sold.
most amount of profit per unit refers to MAX(SUBTRACT(CurrentRetailPrice, WholesaleCost)); least amount of profit per unit refers to MIN(SUBTRACT(CurrentRetailPrice, WholesaleCost));
SELECT * FROM ( SELECT T1.BrandName, T2.ContainerType FROM rootbeerbrand AS T1 INNER JOIN rootbeer AS T2 ON T1.BrandID = T2.BrandID ORDER BY T1.CurrentRetailPrice - T1.WholesaleCost DESC LIMIT 1 ) UNION ALL SELECT * FROM ( SELECT T3.BrandName, T4.ContainerType FROM rootbeerbrand AS T3 INNER JOIN rootbeer AS T4 ON T3.BrandID = T4.BrandID ORDER BY T3.CurrentRetailPrice - T3.WholesaleCost ASC LIMIT 1 )
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
What is the average cost of root beers purchased for more than 2 dollars and sold in bottles?
average cost = DIVIDE(SUM(PurchasePrice > 2), COUNT(RootBeerID) WHERE PurchasePrice > 2); more than 2 dollars refers to PurchasePrice > 2; in bottles refers to ContainerType = 'Bottle';
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Among the root beers sold in bottles, how many are sold at the location 38.559615, -121.42243?
in bottles refers to ContainerType = 'Bottle';  location 38.559615, -121.42243 refers to latitude = 38.559615 AND longitude = -121.42243;
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Among the customers not subscribed to the mailing list, what percentage has given three or more stars in a review?
not subscribed to the mailing list refers to SubscribedToEmailList = 'FALSE'; percentage = MULTIPLY(DIVIDE(SUM(CustomerID WHERE StarRating > 3), COUNT(CustomerID) WHERE SubscribedToEmailList = 'FALSE'), 1.0);
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
Which root beer got the most five stars in 2012? Give the brand name of this beer.
most five stars refers to MAX(COUNT(StarRating = 5)); in 2012 refers to FirstBrewedYear = 2012;
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
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,
beer_factory
In the female customers, how many bought root beer that contains artificial sweetener?
female refers to Gender = 'F'; contains artificial sweetener refers to ArtificialSweetener = 'TRUE';
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'
database name:db_id beer_factory customers table customers Cols: customer id dtype integer, first name dtype text, last name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, Email dtype text, phone number dtype text, first purchase date dtype date, subscribed to email list dtype text, Gender dtype text, geolocation table geolocation Cols: location id dtype integer, Latitude dtype real, Longitude dtype real, location table location Cols: location id dtype integer, location name dtype text, street address dtype text, City dtype text, State dtype text, zip code dtype integer, rootbeerbrand table rootbeerbrand Cols: brand id dtype integer, brand name dtype text, first brewed year dtype integer, brewery name dtype text, City dtype text, State dtype text, Country dtype text, Description dtype text, cane sugar dtype text, corn syrup dtype text, Honey dtype text, artificial sweetener dtype text, Caffeinated dtype text, Alcoholic dtype text, available in cans dtype text, available in bottles dtype text, available in kegs dtype text, Website dtype text, facebook page dtype text, Twitter dtype text, wholesale cost dtype real, current retail price dtype real, rootbeer table rootbeer Cols: root beer id dtype integer, brandid dtype integer, container type dtype text, location id dtype integer, purchase date dtype date, rootbeerreview table rootbeerreview Cols: customer id dtype integer, brand id dtype integer, star rating dtype integer, review date dtype date, Review dtype text, transaction table transaction Cols: transaction id dtype integer, credit card number dtype integer, customer id dtype integer, transaction date dtype date, credit card type dtype text, location id dtype integer, root beer id dtype integer, purchase price dtype real,