Chinastark/bird_dataset huggingface dataset:
Database: software_company
Note: widowed female customers refer to sex = 'Female' where marital_status = 'Widowed'; level of education of 5 and below refers to educationnum ≤ 5;
Question: Among the widowed female customers, give the income of those who has an level of education of 5 and below.
SQL: SELECT income_k FROM demog WHERE geoid IN ( SELECT geoid FROM customers WHERE educationnum < 5 AND sex = 'Female' AND marital_status = 'Widowed' )
Database: software_company
Note: age of 40 to 60 refers to age BETWEEN 40 AND 60; the highest income refers to MAX(income_k);
Question: List the marital status of customers within the age of 40 to 60 that has the highest income among the group.
SQL: SELECT customers.marital_status FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.age >= 40 AND customers.age <= 60 ORDER BY demog.income_k DESC LIMIT 1
Database: software_company
Note: male customers ages from 20 to 30 years old refer to sex = 'Male' where age BETWEEN 20 AND 30; farming or fishing refers to occupation; number of inhabitants refers to inhabitants_k;
Question: What is the number of inhabitants of male customers ages from 20 to 30 years old who are farming or fishing?
SQL: SELECT demog.inhabitants_k FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.occupation = 'Farming-fishing' AND customers.sex = 'Male' AND customers.age >= 20 AND customers.age <= 30
Database: software_company
Note: occupation = 'Machine-op-inspct'; number of inhabitants refers to inhabitants_k;
Question: Among the customers with a marital status of married-civ-spouse, list the number of inhabitants and age of those who are machine-op-inspct.
SQL: SELECT demog.inhabitants_k FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.occupation = 'Farming-fishing' AND customers.sex = 'Male' AND customers.age >= 20 AND customers.age <= 30
Database: software_company
Note: female customers ages from 50 to 60 refer to sex = 'Female' where age BETWEEN 50 AND 60; number of inhabitants ranges from 19 to 24 refers to inhabitants_k BETWEEN 19 AND 24;
Question: In female customers ages from 50 to 60, how many of them has an number of inhabitants ranges from 19 to 24?
SQL: SELECT count(customers.id) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.sex = 'Female' AND customers.age >= 50 AND customers.age <= 60 AND demog.inhabitants_k >= 19 AND demog.inhabitants_k <= 24
Database: software_company
Note: age greater than the 80% of average age refers to age > (AVG(age) * 0.8); income refers to income_k; number of inhabitants refers to inhabitants_k;
Question: List the income and number of inhabitants of customers with an age greater than the 80% of average age of all customers?
SQL: SELECT demog.income_k, demog.inhabitants_k FROM customers INNER JOIN demog ON customers.geoid = demog.geoid GROUP BY demog.income_k, demog.inhabitants_k HAVING customers.age > 0.8 * avg(customers.age)
Database: software_company
Note: DIVidE(COUNT(income_k ≥ 2500 where marital_status = 'Never-married'), COUNT(income_k where marital_status = 'Never-married')) as percentage;
Question: In customers with marital status of never married, what is the percentage of customers with income of 2500 and above?
SQL: SELECT cast(sum(CASE WHEN demog.income_k > 2500 THEN 1.0 ELSE 0 END) AS REAL) * 100 / count(*) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.marital_status = 'Never-married'
Database: software_company
Note: elderly customers with an education level below 3 refer to age > 65 where educationnum < 3; geographic id refers to geoid;
Question: Find and list the id and geographic ID of the elderly customers with an education level below 3.
SQL: SELECT id, geoid FROM customers WHERE educationnum < 3 AND age > 65
Database: software_company
Note: geographic id refers to geoid; income is above average refers to income_k > DIVidE(SUM(income_k), COUNT(geoid));
Question: List the geographic id of places where the income is above average.
SQL: SELECT avg(income_k) FROM demog
Database: software_company
Note: did not respond refers to response = 'false'; February of 2007 refers to ref_date BETWEEN '2007-02-01 12:00:00.0'AND '2007-02-28 12:00:00.0';
Question: Calculate the number of customers who did not respond in February of 2007.
SQL: SELECT count(refid) custmoer_number FROM mailings1_2 WHERE response = 'false' AND ref_date BETWEEN '2007-02-01' AND '2007-02-28'
Database: software_company
Note: teenager is a person aged between 13 and 19 years; occupation = 'Machine-op-inspct';
Question: How many teenagers are working as Machine-op-inspct?
SQL: SELECT count(id) teenager_number FROM customers WHERE occupation = 'Machine-op-inspct' AND age >= 13 AND age <= 19
Database: software_company
Note: occupation = 'Other-service'; inhabitants are more than 20000 refer to inhabitants_k > 20;
Question: Of customers who provide other services, how many are from places where inhabitants are more than 20000?
SQL: SELECT count(demog.geoid) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.occupation = 'Other-service' AND demog.inhabitants_k > 20
Database: software_company
Note: male customer in their twenties refer to sex = 'Male' where age BETWEEN 20 AND 29; average income is more than 3000 refers to income_k > 3000;
Question: Among the male customer in their twenties, how many are from places where the average income is more than 3000?
SQL: SELECT count(demog.geoid) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.sex = 'Male' AND demog.income_k > 3000 AND customers.age >= 20 AND customers.age <= 29
Database: software_company
Note: elderly customers refer to age > 65; DIVidE(COUNT(id where age > 65, marital_status = 'never married' and geoid = 24), COUNT(id where geoid = 24)) as percentage;
Question: What percentage of elderly customers who are never married in the place with geographic ID 24?
SQL: SELECT cast(sum(CASE WHEN customers.marital_status = 'never married' THEN 1.0 ELSE 0 END) AS REAL) * 100 / count(*) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.geoid = 24
Database: software_company
Note: average income per inhabitant above 3000 refers to income_k > 3000; eighties refer to age BETWEEN 80 AND 89; DIVidE(COUNT(income_k > 3000 and age BETWEEN 80 AND 89), COUNT(income_k > 3000 )) as percentage;
Question: Among the customers with an average income per inhabitant above 3000, what percentage are in their eighties?
SQL: SELECT cast(sum(CASE WHEN customers.age BETWEEN 80 AND 89 THEN 1 ELSE 0 END) AS REAL) * 100 / count(customers.id) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE demog.income_k > 3000
Database: software_company
Note: reference id refers to refid;
Question: How many of the customer's reference ID that has a TRUE response?
SQL: SELECT count(refid) FROM mailings1_2 WHERE response = 'true'
Database: software_company
Note: reference id refers to refid;
Question: List down the customer's reference ID with true response.
SQL: SELECT refid FROM mailings1_2 WHERE response = 'true'
Database: software_company
Note: widowed customers with an age below 50 refer to marital_status = 'Widowed' where age < 50;
Question: What is the total number of widowed customers with an age below 50?
SQL: SELECT count(id) FROM customers WHERE marital_status = 'Widowed' AND age < 50
Database: software_company
Note: geographic identifier with an number of inhabitants less than 30 refers to geoid where inhabitants_k < 30;
Question: List down the geographic identifier with an number of inhabitants less than 30.
SQL: SELECT geoid FROM demog WHERE inhabitants_k < 30
Database: software_company
Note: geoid BETWEEN 10 AND 30; income_k < 2000;
Question: In geographic identifier from 10 to 30, how many of them has an income below 2000?
SQL: SELECT count(geoid) FROM demog WHERE income_k < 2000 AND geoid >= 10 AND geoid <= 30
Database: software_company
Note: customer ages 62 with an level of education of 7 refer age = 62 where educationnum = 7;
Question: What is the marital status of the customer ages 62 with an level of education of 7?
SQL: SELECT DISTINCT marital_status FROM customers WHERE educationnum = 7 AND age = 62
Database: software_company
Note: number of inhabitants refers to inhabitants_k; response = 'false';
Question: List down the number of inhabitants of customers with a widowed marital status and false response .
SQL: SELECT count(customers.id) FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.marital_status = 'Widowed' AND mailings1_2.response = 'true'
Database: software_company
Note: number of inhabitants refers to inhabitants_k; oldest female customer refers to sex = 'Female' where MAX(age);
Question: What is the response and number of inhabitants of the oldest female customer?
SQL: SELECT mailings1_2.response, demog.inhabitants_k FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.sex = 'Female' ORDER BY customers.age DESC LIMIT 1
Database: software_company
Note: female customers with level of education of 3 and below refer to sex = 'Female' where educationnum ≤ 3; income refers to income_k;
Question: Among the female customers with an level of education of 3 and below, list their income.
SQL: SELECT income_k FROM demog WHERE geoid IN ( SELECT geoid FROM customers WHERE educationnum < 3 AND sex = 'Female' )
Database: software_company
Note: ages from 30 to 55 refer to age BETWEEN 30 AND 55; response = 'true'; income refers to income_k; education level refers to educationnum;
Question: List the level of education and income of customers ages from 30 to 55 with a true response.
SQL: SELECT customers.educationnum, demog.income_k FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.age >= 30 AND customers.age <= 55 AND mailings1_2.response = 'true'
Database: software_company
Note: male customers ages from 30 to 50 refer to sex = 'Male' where age BETWEEN 30 AND 50; income ranges from 2000 to 2300 refers to income_k BETWEEN 2000 AND 3000;
Question: In male customers ages from 30 to 50, how many of them has an income ranges from 2000 to 2300?
SQL: SELECT count(customers.id) FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.sex = 'Male' AND customers.age >= 30 AND customers.age <= 50 AND demog.income_k >= 2000 AND demog.income_k <= 2300
Database: software_company
Note: age of 20 to 30 refers to age BETWEEN 20 AND 30; the highest number of inhabitants refers to MAX(inhabitants_k);
Question: List the educationnum and response of customers within the age of 20 to 30 that has the highest number of inhabitants among the group.
SQL: SELECT customers.educationnum, mailings1_2.response FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.age >= 20 AND customers.age <= 30 ORDER BY demog.inhabitants_k DESC LIMIT 1
Database: software_company
Note: female customers ages from 30 to 55 years old refer to sex = 'Female' where age BETWEEN 30 AND 55; income refers to income_k;
Question: What is the income of female customers ages from 30 to 55 years old and has an occupation of machine-op-inspct?
SQL: SELECT demog.income_k FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.sex = 'Female' AND customers.age >= 30 AND customers.age <= 55 AND customers.occupation = 'Machine-op-inspct'
Database: software_company
Note: female customers with an level of education of 8 and above refer to sex = 'Female' where educationnum ≥ 8;
Question: List the marital status and response of female customers with an level of education of 8 and above.
SQL: SELECT DISTINCT customers.marital_status, mailings1_2.response FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid WHERE customers.educationnum > 8 AND customers.sex = 'Female'
Database: software_company
Note: female customers within the number of inhabitants below 30 refer to sex = 'Female' where inhabitants_k < 30;
Question: What is the age of female customers within the number of inhabitants below 30?
SQL: SELECT age FROM customers WHERE geoid IN ( SELECT geoid FROM demog WHERE inhabitants_k < 30 ) AND sex = 'Female'
Database: software_company
Note: divorced male customers refer to sex = 'Male' where marital_status = 'Divorced';
Question: Among the divorced male customers, give the income and response of those who has an level of education of 6 and above.
SQL: SELECT DISTINCT demog.income_k, mailings1_2.response FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.educationnum > 6 AND customers.sex = 'Male' AND customers.marital_status = 'Divorced'
Database: software_company
Note: female customers within the number of inhabitants range of 20 to 25 refer to sex = 'Female' where inhabitants_k BETWEEN 20 AND 25;
Question: What is the occupation and response of female customers within the number of inhabitants range of 20 to 25?
SQL: SELECT DISTINCT customers.occupation, mailings1_2.response FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.sex = 'Female' AND demog.inhabitants_k >= 20 AND demog.inhabitants_k <= 25
Database: software_company
Note: DIVidE(COUNT(occupation = 'Handlers-cleaners', sex = 'Male' and response = 'true'), COUNT(occupation = 'Handlers-cleaners' and sex = 'Male')) as percentage;
Question: In male customers with an occupation handlers or cleaners, what is the percentage of customers with a true response?
SQL: SELECT cast(sum(CASE WHEN mailings1_2.response = 'true' THEN 1.0 ELSE 0 END) AS REAL) * 100 / count(mailings1_2.refid) FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid WHERE customers.occupation = 'Handlers-cleaners' AND customers.sex = 'Male'
Database: software_company
Note: reference id greater than the 50% of average of number of false response refers to refid > DIVidE(MULTIPLY(0.5, COUNT(response = 'false')), COUNT(response)); income refers to income_k; number of inhabitants refer to inhabitants_k;
Question: List the income and number of inhabitants of customers with a reference ID greater than the 50% of average of number of false response?
SQL: SELECT demog.income_k, demog.inhabitants_k FROM customers INNER JOIN demog ON customers.geoid = demog.geoid INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid WHERE mailings1_2.refid > ( SELECT 0.5 * count(CASE WHEN response = 'false' THEN 1 ELSE NULL END) / count(response) FROM mailings1_2 )
Database: software_company
Note: ratio = DIVidE(COUNT(sex = 'Male' where age BETWEEN 13 AND 19 and educationnum > 10),COUNT(sex = 'Female' where age BETWEEN 13 AND 19 and educationnum > 10));
Question: What is the ratio of male and female among the age of teenager when the education is above 10?
SQL: SELECT cast(sum(CASE WHEN sex = 'Male' THEN 1 ELSE 0 END) AS REAL) / sum(CASE WHEN sex = 'Female' THEN 1 ELSE 0 END) FROM customers WHERE age BETWEEN 13 AND 19 AND educationnum > 10
Database: software_company
Note: total income per year refers to MULTIPLY(12, inhabitants_k, income_k) where income_k > 3300; geographic id refers to geoid;
Question: What is the geographic ID and total income per year when the average income is above 3300 dollar.
SQL: SELECT geoid, inhabitants_k * income_k * 12 FROM demog WHERE income_k > 3300
Database: software_company
Note: COUNT(refid where response = 'true')>or<COUNT(refid where response = 'false');
Question: Point out the greater one between the number of actual responding and not responding to mailing.
SQL: SELECT response FROM mailings1_2 GROUP BY response ORDER BY count(response) DESC LIMIT 1
Database: software_company
Note: yearly income of geographic id refers to geoid where MULTIPLY(inhabitants_k, income_k, 12); sex = 'Female';
Question: Find out the yearly income of geographic ID when the customer is female and occupation as sales.
SQL: SELECT demog.inhabitants_k * demog.income_k * 12 FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.sex = 'Female' AND customers.occupation = 'Sales'
Database: software_company
Note: geographic id which has 33.658K of inhabitants refers to geoid where inhabitants_k = 33.658; education refers to educationnum; female widow refers to sex = 'Female' where marital_status = 'Widowed';
Question: Among the geographic ID which has 33.658K of inhabitants, describe the education, occupation and age of female widow.
SQL: SELECT customers.educationnum, customers.occupation, customers.age FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE demog.inhabitants_k = 33.658 AND customers.sex = 'Female' AND customers.marital_status = 'Widowed'
Database: software_company
Note: geoid = 134;
Question: Find the response status to customer whose geographic ID of 134.
SQL: SELECT mailings3.response FROM customers INNER JOIN mailings3 ON customers.id = mailings3.refid WHERE customers.geoid = 134
Database: software_company
Note: the average income per month refers to income_k; yearly income of geographic id refers to geoid where MULTIPLY(inhabitants_k, income_k, 12);
Question: Describe the average income per month and yearly income of the geographic ID in which customer of ID "209556" and "290135".
SQL: SELECT demog.income_k, demog.inhabitants_k * demog.income_k * 12 FROM customers INNER JOIN demog ON customers.geoid = demog.geoid WHERE customers.id = 209556 OR customers.id = 290135
Database: software_company
Note: reference id of under 10 refers to refid < 10; got response refers to response = 'true'; education status refers to educationnum;
Question: Among the reference ID of under 10 who got response by marketing department, compare their education status.
SQL: SELECT customers.educationnum FROM customers INNER JOIN mailings1_2 ON customers.id = mailings1_2.refid WHERE mailings1_2.refid < 10 AND mailings1_2.response = 'true'
Database: chicago_crime
Note: Central Chicago refers to side = 'Central';
Question: How many community areas are there in Central Chicago?
SQL: SELECT count(*) FROM community_area WHERE side = 'Central'
Database: chicago_crime
Note: district refers to side; community area Lincoln Square refers to community_area_name = 'Lincoln Square';
Question: Which district is the community area Lincoln Square grouped into?
SQL: SELECT side FROM community_area WHERE community_area_name = 'Lincoln Square'
Database: chicago_crime
Note: district refers to side; the most community areas refers to max(count(side));
Question: Which district in Chicago has the most community areas?
SQL: SELECT side FROM community_area GROUP BY side ORDER BY count(side) DESC LIMIT 1
Database: chicago_crime
Note: community area refers to community_area_name; the least population refers to min(population);
Question: Which community area has the least population?
SQL: SELECT community_area_name FROM community_area ORDER BY population ASC LIMIT 1
Database: chicago_crime
Note: the person responsible for the crime cases refers to commander; Central Chicago refers to district_name = 'Central';
Question: Who is the person responsible for the crime cases in Central Chicago?
SQL: SELECT commander FROM district WHERE district_name = 'Central'
Database: chicago_crime
Note: email address refers to email; Central Chicago refers to district_name = 'Central';
Question: What is the email address to contact the administrator of Central Chicago?
SQL: SELECT email FROM district WHERE district_name = 'Central'
Database: chicago_crime
Note: community area refers to community_area_name; the neighborhood Albany Park refers to neighborhood_name = 'Albany Park';
Question: To which community area does the neighborhood Albany Park belong?
SQL: SELECT community_area.community_area_name FROM neighborhood INNER JOIN community_area ON neighborhood.community_area_no = community_area.community_area_no WHERE neighborhood.neighborhood_name = 'Albany Park'
Database: chicago_crime
Note: the community area of Lincoln Square refers to community_area_name = 'Lincoln Square';
Question: How many neighborhoods are there in the community area of Lincoln Square?
SQL: SELECT count(t3.community_area_no) FROM ( SELECT community_area.community_area_no FROM community_area INNER JOIN neighborhood ON community_area.community_area_no = neighborhood.community_area_no WHERE community_area_name = 'Lincoln Square' GROUP BY community_area.community_area_no ) t3
Database: chicago_crime
Note: name of neighborhood refers to neighborhood_name; the most population refers to max(population);
Question: Please list the names of all the neighborhoods in the community area with the most population.
SQL: SELECT neighborhood.neighborhood_name FROM neighborhood INNER JOIN community_area ON community_area.community_area_no = community_area.community_area_no ORDER BY community_area.population DESC LIMIT 1
Database: chicago_crime
Note: name of neighborhood refers to neighborhood_name; Central Chicago refers to side = 'Central';
Question: Please list the names of all the neighborhoods in Central Chicago.
SQL: SELECT neighborhood.neighborhood_name FROM community_area INNER JOIN neighborhood ON community_area.community_area_no = neighborhood.community_area_no WHERE community_area.side = 'Central'
Database: chicago_crime
Note: location coordinates refers to latitude, longitude; Central Chicago refers to district_name = 'Central';
Question: Please list the precise location coordinates of all the crimes in Central Chicago.
SQL: SELECT crime.latitude, crime.longitude FROM district INNER JOIN crime ON district.district_no = crime.district_no WHERE district.district_name = 'Central'
Database: chicago_crime
Note: Central Chicago refers to district_name = 'Central';
Question: How many crimes had happened in Central Chicago?
SQL: SELECT count(*) FROM crime INNER JOIN district ON crime.district_no = district.district_no WHERE district.district_name = 'Central'
Database: chicago_crime
Note: Central Chicago refers to district_name = 'Central'; case of domestic violence refers to domestic = 'TRUE';
Question: Among all the crimes that had happened in Central Chicago, how many of them were cases of domestic violence?
SQL: SELECT count(*) FROM crime INNER JOIN district ON crime.district_no = district.district_no WHERE district.district_name = 'Central' AND crime.domestic = 'TRUE'
Database: chicago_crime
Note: no arrest made refers to arrest = 'FALSE'; Central Chicago refers to district_name = 'Central';
Question: Please list the case numbers of all the crimes with no arrest made in Central Chicago.
SQL: SELECT count(*) FROM crime INNER JOIN district ON crime.district_no = district.district_no WHERE district.district_name = 'Central' AND crime.arrest = 'FALSE'
Database: chicago_crime
Note: the most population refers to max(population);
Question: How many crimes had happened in the community area with the most population?
SQL: SELECT count(crime.report_no) FROM community_area INNER JOIN crime ON community_area.community_area_no = crime.community_area_no GROUP BY community_area.community_area_name ORDER BY community_area.population DESC LIMIT 1
Database: chicago_crime
Note: Woodlawn refers to community_area_name = 'Woodlawn'; in January 2018 refers to date like '%1/2018%';
Question: Among the crimes in Woodlawn, how many of them happened in January, 2018?
SQL: SELECT sum(CASE WHEN community_area.community_area_name = 'Woodlawn' THEN 1 ELSE 0 END) FROM community_area INNER JOIN crime ON community_area.community_area_no = crime.community_area_no WHERE crime.date LIKE '%1/2018%'