db_id stringclasses 69 values | question stringlengths 24 325 | evidence stringlengths 0 673 | SQL stringlengths 23 804 |
|---|---|---|---|
mondial_geo | Which Asian country gave its agricultural sector the largest share of its gross domestic product? | Gross domestic product = GDP; Largest share of GDP in agricultural sector was mentioned in economy.Agriculture | SELECT T2.Country FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T2.Country = T3.Code INNER JOIN economy AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Asia' ORDER BY T4.Agriculture DESC LIMIT 1 |
mondial_geo | What form of governance does the least prosperous nation in the world have? | Nation and country are synonyms; Form of governance was mentioned in politics.Government; Least prosperous means lowest GDP | SELECT T3.Government FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country INNER JOIN politics AS T3 ON T3.Country = T2.Country WHERE T2.GDP IS NOT NULL ORDER BY T2.GDP ASC LIMIT 1 |
mondial_geo | What year saw the greatest number of organizations created on the European continent? | SELECT STRFTIME('%Y', T4.Established) FROM continent AS T1 INNER JOIN encompasses AS T2 ON T1.Name = T2.Continent INNER JOIN country AS T3 ON T2.Country = T3.Code INNER JOIN organization AS T4 ON T4.Country = T3.Code WHERE T1.Name = 'Europe' GROUP BY STRFTIME('%Y', T4.Established) ORDER BY COUNT(T4.Name) DESC LIMIT 1 | |
mondial_geo | What other country does the most populated nation in the world share a border with and how long is the border between the two nations? | Nation and country are synonyms | SELECT T2.Country2, T2.Length FROM country AS T1 INNER JOIN borders AS T2 ON T1.Code = T2.Country1 INNER JOIN country AS T3 ON T3.Code = T2.Country2 WHERE T1.Name = ( SELECT Name FROM country ORDER BY Population DESC LIMIT 1 ) |
mondial_geo | What is the population density of the nation whose capital city is in the Distrito Federal province, and what portion of its gross domestic product is devoted to its industries? | ation and country are synonyms; Gross domestic product = GDP; Portion of GDP devoted to industries appears in economy.Industry; Population Density = Population / Area | SELECT T1.Population / T1.Area, T2.Industry FROM country AS T1 INNER JOIN economy AS T2 ON T1.Code = T2.Country WHERE T1.Province = 'Distrito Federal' |
mondial_geo | Lists all governments with a parliamentary democracy that achieved their independence between 01/01/1950 and 12/31/1999. | Inhabitants, synonymous with population | SELECT * FROM politics WHERE STRFTIME('%Y', Independence) BETWEEN '1950' AND '1999' AND Government = 'parliamentary democracy' |
mondial_geo | What percentage of countries became independent during the year 1960? | Percentage = count(countries independent 1960) / total num of countries | SELECT CAST(SUM(CASE WHEN STRFTIME('%Y', Independence) = '1960' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Country) FROM politics |
mondial_geo | List all deserts that are not between latitudes 30 and 40. | SELECT Name FROM desert WHERE Latitude < 30 OR Latitude > 40 | |
mondial_geo | Indicate the coordinates of all the deserts whose area is in more than one country. | coordinates consists of Latitude, Longitude | SELECT T1.Latitude, T1.Longitude FROM desert AS T1 INNER JOIN geo_desert AS T2 ON T1.Name = T2.Desert GROUP BY T1.Name, T1.Latitude, T1.Longitude HAVING COUNT(T1.Name) > 1 |
mondial_geo | What is the provincial capital of the province with a population of less than 80,000 that has the highest average population per area? | Average population per area = population / area | SELECT CapProv FROM province WHERE Population < 80000 ORDER BY Population / Area DESC LIMIT 1 |
software_company | How many customers have never married? | MARITAL_STATUS = 'Never-married'; | SELECT COUNT(ID) FROM Customers WHERE MARITAL_STATUS = 'Never-married' |
software_company | Among all the customers, how many of them are teenagers? | teenager is a person aged between 13 and 19 years; | SELECT COUNT(ID) FROM Customers WHERE age >= 13 AND age <= 19 |
software_company | Please list the occupations of the customers with an education level of 11. | education level of 11 refers to EDUCATIONNUM = 11; | SELECT DISTINCT OCCUPATION FROM Customers WHERE EDUCATIONNUM = 11 |
software_company | Of the first 60,000 customers' responses to the incentive mailing sent by the marketing department, how many of them are considered a true response? | RESPONSE = 'true'; | SELECT COUNT(REFID) custmoer_number FROM Mailings1_2 WHERE RESPONSE = 'true' |
software_company | Among the customers over 30, how many of them are Machine-op-inspcts? | over 30 refers to age > 30; OCCUPATION = 'Machine-op-inspct'; | SELECT COUNT(ID) FROM Customers WHERE OCCUPATION = 'Machine-op-inspct' AND age > 30 |
software_company | How many female customers have an education level of over 11? | education level of 11 refers to EDUCATIONNUM = 11; SEX = 'Female'; | SELECT COUNT(ID) FROM Customers WHERE EDUCATIONNUM > 11 AND SEX = 'Female' |
software_company | Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are female? | RESPONSE = 'true'; SEX = 'Female'; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.SEX = 'Female' AND T2.RESPONSE = 'true' |
software_company | Please list the occupations of the customers over 40 and have sent a true response to the incentive mailing sent by the marketing department. | over 40 refers to age > 40; RESPONSE = 'true'; | SELECT DISTINCT T1.OCCUPATION FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.age > 40 AND T2.RESPONSE = 'true' |
software_company | Among the male customers, how many of them come from a place with over 30,000 inhabitants? | SEX = 'Male', over 30,000 inhabitants refer to NHABITANTS_K > 30; place refers to GEOID; | SELECT COUNT(T1.GEOID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Male' AND T2.INHABITANTS_K > 30 |
software_company | How many customers are from the place with the highest average income per month? | place with the highest average income per month refers to GEOID where MAX(INCOME_K); | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID ORDER BY T2.INCOME_K DESC LIMIT 1 |
software_company | Among the customers from a place with more than 20,000 and less than 30,000 inhabitants, how many of them are Machine-op-inspcts? | place with more than 20,000 and less than 30,000 inhabitants refers to GEOID where INHABITANTS_K BETWEEN 20 AND 30; OCCUPATION = 'Machine-op-inspct'; | SELECT COUNT(T1.GEOID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Machine-op-inspct' AND T2.INHABITANTS_K > 20 AND T2.INHABITANTS_K < 30 |
software_company | Which customer come from a place with more inhabitants, customer no.0 or customer no.1? | place with more inhabitants refers to GEOID where ID = 0 OR ID = 1 and MAX(NHABITANTS_K); | SELECT T1.ID FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.ID = 0 OR T1.ID = 1 ORDER BY INHABITANTS_K DESC LIMIT 1 |
software_company | Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are from a place with more than 30,000 inhabitants? | RESPONSE = 'true'; place with more than 30,000 inhabitants refers to GEOID where INHABITANTS_K > 30; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T3.INHABITANTS_K > 30 AND T2.RESPONSE = 'true' |
software_company | Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are divorced males? | RESPONSE = 'true'; SEX = 'Male'; MARITAL_STATUS = 'Divorced'; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.SEX = 'Male' AND T1.MARITAL_STATUS = 'Divorced' AND T2.RESPONSE = 'true' |
software_company | How many of the first 60,000 customers from the place with the highest average income per month have sent a true response to the incentive mailing sent by the marketing department? | place with the highest average income per month refers to GEOID where MAX(INCOME_K); RESPONSE = 'true'; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T2.RESPONSE = 'true' ORDER BY T3.INCOME_K DESC LIMIT 1 |
software_company | What is the number of inhabitants of the place the most customers are from? | the most customers are from refers to GEOID where MAX(COUNT(ID)); number of inhabitants refers to INHABITANTS_K; | SELECT DISTINCT T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID ORDER BY T2.INHABITANTS_K DESC |
software_company | Among the customers who come from the place with 25746 inhabitants, how many of them are male? | place with 44114 inhabitants refers to GEOID where INHABITANTS_K = 44.114; SEX = 'Male'; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INHABITANTS_K = 25.746 AND T1.SEX = 'Male' |
software_company | Of the first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department, how many of them are teenagers? | RESPONSE = 'true'; teenagers are people aged between 13 and 19 years; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.age >= 13 AND T1.age <= 19 AND T2.RESPONSE = 'true' |
software_company | What is the average education level of customers from the place with the highest average income per month? | place with the highest average income per month refers to GEOID where MAX(INCOME_K); average education level refers to AVG(EDUCATIONNUM); | SELECT AVG(T1.EDUCATIONNUM) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID ORDER BY T2.INCOME_K DESC LIMIT 1 |
software_company | What is the average age of first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department? | RESPONSE = 'true'; AVG(age); | SELECT AVG(T1.age) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T2.RESPONSE = 'true' |
software_company | How many of the customers are male? | SEX = 'Male'; | SELECT COUNT(ID) FROM Customers WHERE SEX = 'Male' |
software_company | List down the customer's geographic identifier who are handlers or cleaners. | geographic identifier refers to GEOID; OCCUPATION = 'Handlers-cleaners'; | SELECT GEOID FROM Customers WHERE OCCUPATION = 'Handlers-cleaners' |
software_company | What is the total number of customers with an age below 30? | age below 30 refers to age < 30; | SELECT COUNT(ID) FROM Customers WHERE age < 30 |
software_company | List down the geographic identifier with an income that ranges from 2100 to 2500. | geographic identifier with an income that ranges from 2100 to 2500 refers to GEOID where INCOME_K BETWEEN 2100 AND 2500; | SELECT GEOID FROM Demog WHERE INCOME_K >= 2100 AND INCOME_K <= 2500 |
software_company | In geographic identifier from 20 to 50, how many of them has a number of inhabitants below 20? | geographic identifier from 20 to 50 refers to GEOID BETWEEN 20 AND 50; number of inhabitants below 20 refers to INHABITANTS_K < 20; | SELECT COUNT(GEOID) FROM Demog WHERE INHABITANTS_K < 20 AND GEOID >= 20 AND GEOID <= 50 |
software_company | What is the number of inhabitants and income of geographic identifier 239? | geographic identifier 239 refers to GEOID = 239; number of inhabitants refers to INHABITANTS_K; income refers to INCOME_K; | SELECT INHABITANTS_K FROM Demog WHERE GEOID = 239 |
software_company | Give the level of education and occupation of customers ages from 20 to 35 with an income K of 2000 and below. | customers ages from 20 to 35 refer to ID where age BETWEEN 20 AND 35; income K of 2000 and below refers to INCOME_K < 2000; level of education refers to EDUCATIONNUM; | SELECT T1.EDUCATIONNUM, T1.OCCUPATION FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INCOME_K < 2000 AND T1.age >= 20 AND T1.age <= 35 |
software_company | List down the number of inhabitants of customers with a divorced marital status and older than 50 years old. | number of inhabitants refers to INHABITANTS_K; older than 50 years old refers to age < 50; MARITAL_STATUS = 'Divorced; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.MARITAL_STATUS = 'Divorced' AND T1.age < 50 |
software_company | What is the geographic identifier and income of the oldest customer? | the oldest customer refers to MAX(age); geographic identifier refers to GEOID; income refers to INCOME_K; | SELECT T1.GEOID, T2.INCOME_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID ORDER BY T1.age DESC LIMIT 1 |
software_company | Among the male customers with an level of education of 4 and below, list their income K. | male customers with an level of education of 4 and below refer to SEX = 'Male' where EDUCATIONNUM < 4; | SELECT INCOME_K FROM Demog WHERE GEOID IN ( SELECT GEOID FROM Customers WHERE EDUCATIONNUM < 4 AND SEX = 'Male' ) |
software_company | List the occupation and income of male customers with an level of education of 4 to 6. | male customers with an level of education of 4 to 6 refer to SEX = 'Male' where EDUCATIONNUM BETWEEN 4 AND 6; income refers to INCOME_K; | SELECT T1.OCCUPATION, T2.INCOME_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.EDUCATIONNUM >= 4 AND T1.EDUCATIONNUM <= 6 AND T1.SEX = 'Male' |
software_company | In widowed male customers ages from 40 to 60, how many of them has an income ranges from 3000 and above? | widowed male customers ages from 40 to 60 refer to SEX = 'Male' where age BETWEEN 40 AND 60 and MARITAL_STATUS = 'Widowed'; income ranges from 3000 and above refers to INCOME_K BETWEEN 2000 AND 3000; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.age >= 40 AND T1.age <= 60 AND T1.MARITAL_STATUS = 'Widowed' AND T1.SEX = 'Male' AND T2.INCOME_K >= 2000 AND T2.INCOME_K <= 3000 |
software_company | What is the occupation of customers within number of inhabitants ranges of 30 to 40? | number of inhabitants ranges of 30 to 40 refers to INHABITANTS_K BETWEEN 30 AND 40; | SELECT DISTINCT T1.OCCUPATION FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INHABITANTS_K >= 30 AND T2.INHABITANTS_K <= 40 |
software_company | Among the widowed female customers, give the income of those who has an level of education of 5 and below. | widowed female customers refer to SEX = 'Female' where MARITAL_STATUS = 'Widowed'; level of education of 5 and below refers to EDUCATIONNUM ≤ 5; | SELECT INCOME_K FROM Demog WHERE GEOID IN ( SELECT GEOID FROM Customers WHERE EDUCATIONNUM < 5 AND SEX = 'Female' AND MARITAL_STATUS = 'Widowed' ) |
software_company | List the marital status of customers within the age of 40 to 60 that has the highest income among the group. | age of 40 to 60 refers to age BETWEEN 40 AND 60; the highest income refers to MAX(INCOME_K); | SELECT T1.MARITAL_STATUS FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.age >= 40 AND T1.age <= 60 ORDER BY T2.INCOME_K DESC LIMIT 1 |
software_company | What is the number of inhabitants of male customers ages from 20 to 30 years old who are farming or fishing? | 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; | SELECT T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Farming-fishing' AND T1.SEX = 'Male' AND T1.age >= 20 AND T1.age <= 30 |
software_company | 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. | OCCUPATION = 'Machine-op-inspct'; number of inhabitants refers to INHABITANTS_K; | SELECT T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Farming-fishing' AND T1.SEX = 'Male' AND T1.age >= 20 AND T1.age <= 30 |
software_company | In female customers ages from 50 to 60, how many of them has an number of inhabitants ranges from 19 to 24? | 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; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Female' AND T1.age >= 50 AND T1.age <= 60 AND T2.INHABITANTS_K >= 19 AND T2.INHABITANTS_K <= 24 |
software_company | List the income and number of inhabitants of customers with an age greater than the 80% of average age of all customers? | 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; | SELECT T2.INCOME_K, T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID GROUP BY T2.INCOME_K, T2.INHABITANTS_K HAVING T1.age > 0.8 * AVG(T1.age) |
software_company | In customers with marital status of never married, what is the percentage of customers with income of 2500 and above? | DIVIDE(COUNT(INCOME_K ≥ 2500 where MARITAL_STATUS = 'Never-married'), COUNT(INCOME_K where MARITAL_STATUS = 'Never-married')) as percentage; | SELECT CAST(SUM(CASE WHEN T2.INCOME_K > 2500 THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.MARITAL_STATUS = 'Never-married' |
software_company | Find and list the id and geographic ID of the elderly customers with an education level below 3. | elderly customers with an education level below 3 refer to age > 65 where EDUCATIONNUM < 3; geographic ID refers to GEOID; | SELECT ID, GEOID FROM Customers WHERE EDUCATIONNUM < 3 AND age > 65 |
software_company | List the geographic id of places where the income is above average. | geographic ID refers to GEOID; income is above average refers to INCOME_K > DIVIDE(SUM(INCOME_K), COUNT(GEOID)); | SELECT AVG(INCOME_K) FROM Demog |
software_company | Calculate the number of customers who did not respond in February of 2007. | 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'; | SELECT COUNT(REFID) custmoer_number FROM Mailings1_2 WHERE RESPONSE = 'false' AND REF_DATE BETWEEN '2007-02-01' AND '2007-02-28' |
software_company | How many teenagers are working as Machine-op-inspct? | teenager is a person aged between 13 and 19 years; OCCUPATION = 'Machine-op-inspct'; | SELECT COUNT(ID) teenager_number FROM Customers WHERE OCCUPATION = 'Machine-op-inspct' AND age >= 13 AND age <= 19 |
software_company | Of customers who provide other services, how many are from places where inhabitants are more than 20000? | OCCUPATION = 'Other-service'; inhabitants are more than 20000 refer to INHABITANTS_K > 20; | SELECT COUNT(T2.GEOID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Other-service' AND T2.INHABITANTS_K > 20 |
software_company | Among the male customer in their twenties, how many are from places where the average income is more than 3000? | 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; | SELECT COUNT(T2.GEOID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Male' AND T2.INCOME_K > 3000 AND T1.age >= 20 AND T1.age <= 29 |
software_company | What percentage of elderly customers who are never married in the place with geographic ID 24? | 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; | SELECT CAST(SUM(CASE WHEN T1.MARITAL_STATUS = 'never married' THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.GEOID = 24 |
software_company | Among the customers with an average income per inhabitant above 3000, what percentage are in their eighties? | 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; | SELECT CAST(SUM(CASE WHEN T1.age BETWEEN 80 AND 89 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INCOME_K > 3000 |
software_company | How many of the customer's reference ID that has a TRUE response? | reference ID refers to REFID; | SELECT COUNT(REFID) FROM Mailings1_2 WHERE RESPONSE = 'true' |
software_company | List down the customer's reference ID with true response. | reference ID refers to REFID; | SELECT REFID FROM Mailings1_2 WHERE RESPONSE = 'true' |
software_company | What is the total number of widowed customers with an age below 50? | widowed customers with an age below 50 refer to MARITAL_STATUS = 'Widowed' where age < 50; | SELECT COUNT(ID) FROM Customers WHERE MARITAL_STATUS = 'Widowed' AND age < 50 |
software_company | List down the geographic identifier with an number of inhabitants less than 30. | geographic identifier with an number of inhabitants less than 30 refers to GEOID where INHABITANTS_K < 30; | SELECT GEOID FROM Demog WHERE INHABITANTS_K < 30 |
software_company | In geographic identifier from 10 to 30, how many of them has an income below 2000? | GEOID BETWEEN 10 AND 30; INCOME_K < 2000; | SELECT COUNT(GEOID) FROM Demog WHERE INCOME_K < 2000 AND GEOID >= 10 AND GEOID <= 30 |
software_company | What is the marital status of the customer ages 62 with an level of education of 7? | customer ages 62 with an level of education of 7 refer age = 62 where EDUCATIONNUM = 7; | SELECT DISTINCT MARITAL_STATUS FROM Customers WHERE EDUCATIONNUM = 7 AND age = 62 |
software_company | List down the number of inhabitants of customers with a widowed marital status and false response . | number of inhabitants refers to INHABITANTS_K; RESPONSE = 'false'; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T1.MARITAL_STATUS = 'Widowed' AND T2.RESPONSE = 'true' |
software_company | What is the response and number of inhabitants of the oldest female customer? | number of inhabitants refers to INHABITANTS_K; oldest female customer refers to SEX = 'Female' where MAX(age); | SELECT T2.RESPONSE, T3.INHABITANTS_K FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T1.SEX = 'Female' ORDER BY T1.age DESC LIMIT 1 |
software_company | Among the female customers with an level of education of 3 and below, list their income. | female customers with level of education of 3 and below refer to SEX = 'Female' where EDUCATIONNUM ≤ 3; income refers to INCOME_K; | SELECT INCOME_K FROM Demog WHERE GEOID IN ( SELECT GEOID FROM Customers WHERE EDUCATIONNUM < 3 AND SEX = 'Female' ) |
software_company | List the level of education and income of customers ages from 30 to 55 with a true response. | ages from 30 to 55 refer to age BETWEEN 30 AND 55; RESPONSE = 'true'; income refers to INCOME_K; education level refers to EDUCATIONNUM; | SELECT T1.EDUCATIONNUM, T3.INCOME_K FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T1.age >= 30 AND T1.age <= 55 AND T2.RESPONSE = 'true' |
software_company | In male customers ages from 30 to 50, how many of them has an income ranges from 2000 to 2300? | 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; | SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Male' AND T1.age >= 30 AND T1.age <= 50 AND T2.INCOME_K >= 2000 AND T2.INCOME_K <= 2300 |
software_company | List the educationnum and response of customers within the age of 20 to 30 that has the highest number of inhabitants among the group. | age of 20 to 30 refers to age BETWEEN 20 AND 30; the highest number of inhabitants refers to MAX(INHABITANTS_K); | SELECT T1.EDUCATIONNUM, T2.RESPONSE FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T1.age >= 20 AND T1.age <= 30 ORDER BY T3.INHABITANTS_K DESC LIMIT 1 |
software_company | What is the income of female customers ages from 30 to 55 years old and has an occupation of machine-op-inspct? | female customers ages from 30 to 55 years old refer to SEX = 'Female' where age BETWEEN 30 AND 55; income refers to INCOME_K; | SELECT T2.INCOME_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Female' AND T1.age >= 30 AND T1.age <= 55 AND T1.OCCUPATION = 'Machine-op-inspct' |
software_company | List the marital status and response of female customers with an level of education of 8 and above. | female customers with an level of education of 8 and above refer to SEX = 'Female' where EDUCATIONNUM ≥ 8; | SELECT DISTINCT T1.MARITAL_STATUS, T2.RESPONSE FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.EDUCATIONNUM > 8 AND T1.SEX = 'Female' |
software_company | What is the age of female customers within the number of inhabitants below 30? | female customers within the number of inhabitants below 30 refer to SEX = 'Female' where INHABITANTS_K < 30; | SELECT age FROM Customers WHERE GEOID IN ( SELECT GEOID FROM Demog WHERE INHABITANTS_K < 30 ) AND SEX = 'Female' |
software_company | Among the divorced male customers, give the income and response of those who has an level of education of 6 and above. | divorced male customers refer to SEX = 'Male' where MARITAL_STATUS = 'Divorced'; | SELECT DISTINCT T3.INCOME_K, T2.RESPONSE FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T1.EDUCATIONNUM > 6 AND T1.SEX = 'Male' AND T1.MARITAL_STATUS = 'Divorced' |
software_company | What is the occupation and response of female customers within the number of inhabitants range of 20 to 25? | female customers within the number of inhabitants range of 20 to 25 refer to SEX = 'Female' where INHABITANTS_K BETWEEN 20 AND 25; | SELECT DISTINCT T1.OCCUPATION, T2.RESPONSE FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID INNER JOIN Demog AS T3 ON T1.GEOID = T3.GEOID WHERE T1.SEX = 'Female' AND T3.INHABITANTS_K >= 20 AND T3.INHABITANTS_K <= 25 |
software_company | In male customers with an occupation handlers or cleaners, what is the percentage of customers with a true response? | DIVIDE(COUNT(OCCUPATION = 'Handlers-cleaners', SEX = 'Male' and RESPONSE = 'true'), COUNT(OCCUPATION = 'Handlers-cleaners' and SEX = 'Male')) as percentage; | SELECT CAST(SUM(CASE WHEN T2.RESPONSE = 'true' THEN 1.0 ELSE 0 END) AS REAL) * 100 / COUNT(T2.REFID) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T1.OCCUPATION = 'Handlers-cleaners' AND T1.SEX = 'Male' |
software_company | List the income and number of inhabitants of customers with a reference ID greater than the 50% of average of number of false response? | 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; | SELECT T2.INCOME_K, T2.INHABITANTS_K FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID INNER JOIN Mailings1_2 AS T3 ON T1.ID = T3.REFID WHERE T3.REFID > ( SELECT 0.5 * COUNT(CASE WHEN RESPONSE = 'false' THEN 1 ELSE NULL END) / COUNT(RESPONSE) FROM Mailings1_2 ) |
software_company | What is the ratio of male and female among the age of teenager when the education is above 10? | 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)); | 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 |
software_company | What is the geographic ID and total income per year when the average income is above 3300 dollar. | total income per year refers to MULTIPLY(12, INHABITANTS_K, INCOME_K) where INCOME_K > 3300; geographic ID refers to GEOID; | SELECT GEOID, INHABITANTS_K * INCOME_K * 12 FROM Demog WHERE INCOME_K > 3300 |
software_company | Point out the greater one between the number of actual responding and not responding to mailing. | COUNT(REFID where RESPONSE = 'true')>or<COUNT(REFID where RESPONSE = 'false'); | SELECT RESPONSE FROM Mailings1_2 GROUP BY RESPONSE ORDER BY COUNT(RESPONSE) DESC LIMIT 1 |
software_company | Find out the yearly income of geographic ID when the customer is female and occupation as sales. | yearly income of geographic ID refers to GEOID where MULTIPLY(INHABITANTS_K, INCOME_K, 12); SEX = 'Female'; | SELECT T2.INHABITANTS_K * T2.INCOME_K * 12 FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Female' AND T1.OCCUPATION = 'Sales' |
software_company | Among the geographic ID which has 33.658K of inhabitants, describe the education, occupation and age of female widow. | 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'; | SELECT T1.EDUCATIONNUM, T1.OCCUPATION, T1.age FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T2.INHABITANTS_K = 33.658 AND T1.SEX = 'Female' AND T1.MARITAL_STATUS = 'Widowed' |
software_company | Find the response status to customer whose geographic ID of 134. | GEOID = 134; | SELECT T2.RESPONSE FROM Customers AS T1 INNER JOIN mailings3 AS T2 ON T1.ID = T2.REFID WHERE T1.GEOID = 134 |
software_company | Describe the average income per month and yearly income of the geographic ID in which customer of ID "209556" and "290135". | the average income per month refers to INCOME_K; yearly income of geographic ID refers to GEOID where MULTIPLY(INHABITANTS_K, INCOME_K, 12); | SELECT T2.INCOME_K, T2.INHABITANTS_K * T2.INCOME_K * 12 FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.ID = 209556 OR T1.ID = 290135 |
software_company | Among the reference ID of under 10 who got response by marketing department, compare their education status. | reference ID of under 10 refers to REFID < 10; got response refers to RESPONSE = 'true'; education status refers to EDUCATIONNUM; | SELECT T1.EDUCATIONNUM FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T2.REFID < 10 AND T2.RESPONSE = 'true' |
chicago_crime | How many community areas are there in Central Chicago? | Central Chicago refers to side = 'Central' | SELECT COUNT(*) FROM Community_Area WHERE side = 'Central' |
chicago_crime | Which district is the community area Lincoln Square grouped into? | district refers to side; community area Lincoln Square refers to community_area_name = 'Lincoln Square' | SELECT side FROM Community_Area WHERE community_area_name = 'Lincoln Square' |
chicago_crime | Which district in Chicago has the most community areas? | district refers to side; the most community areas refers to max(count(side)) | SELECT side FROM Community_Area GROUP BY side ORDER BY COUNT(side) DESC LIMIT 1 |
chicago_crime | Which community area has the least population? | community area refers to community_area_name; the least population refers to min(population) | SELECT community_area_name FROM Community_Area ORDER BY population ASC LIMIT 1 |
chicago_crime | Who is the person responsible for the crime cases in Central Chicago? | the person responsible for the crime cases refers to commander; Central Chicago refers to district_name = 'Central' | SELECT commander FROM District WHERE district_name = 'Central' |
chicago_crime | What is the email address to contact the administrator of Central Chicago? | email address refers to email; Central Chicago refers to district_name = 'Central' | SELECT email FROM District WHERE district_name = 'Central' |
chicago_crime | To which community area does the neighborhood Albany Park belong? | community area refers to community_area_name; the neighborhood Albany Park refers to neighborhood_name = 'Albany Park' | SELECT T2.community_area_name FROM Neighborhood AS T1 INNER JOIN Community_Area AS T2 ON T1.community_area_no = T2.community_area_no WHERE T1.neighborhood_name = 'Albany Park' |
chicago_crime | How many neighborhoods are there in the community area of Lincoln Square? | the community area of Lincoln Square refers to community_area_name = 'Lincoln Square' | SELECT COUNT(T3.community_area_no) FROM ( SELECT T1.community_area_no FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no WHERE community_area_name = 'Lincoln Square' GROUP BY T1.community_area_no ) T3 |
chicago_crime | Please list the names of all the neighborhoods in the community area with the most population. | name of neighborhood refers to neighborhood_name; the most population refers to max(population) | SELECT T1.neighborhood_name FROM Neighborhood AS T1 INNER JOIN Community_Area AS T2 ON T2.community_area_no = T2.community_area_no ORDER BY T2.population DESC LIMIT 1 |
chicago_crime | Please list the names of all the neighborhoods in Central Chicago. | name of neighborhood refers to neighborhood_name; Central Chicago refers to side = 'Central' | SELECT T2.neighborhood_name FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no WHERE T1.side = 'Central' |
chicago_crime | Please list the precise location coordinates of all the crimes in Central Chicago. | location coordinates refers to latitude, longitude; Central Chicago refers to district_name = 'Central' | SELECT T2.latitude, T2.longitude FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T1.district_name = 'Central' |
chicago_crime | How many crimes had happened in Central Chicago? | Central Chicago refers to district_name = 'Central' | SELECT COUNT(*) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central' |
chicago_crime | Among all the crimes that had happened in Central Chicago, how many of them were cases of domestic violence? | Central Chicago refers to district_name = 'Central'; case of domestic violence refers to domestic = 'TRUE' | SELECT COUNT(*) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central' AND T1.domestic = 'TRUE' |
chicago_crime | Please list the case numbers of all the crimes with no arrest made in Central Chicago. | no arrest made refers to arrest = 'FALSE'; Central Chicago refers to district_name = 'Central' | SELECT COUNT(*) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central' AND T1.arrest = 'FALSE' |
chicago_crime | How many crimes had happened in the community area with the most population? | the most population refers to max(population) | SELECT COUNT(T2.report_no) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no GROUP BY T1.community_area_name ORDER BY T1.population DESC LIMIT 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.