problem
stringlengths
121
422
db_id
stringclasses
69 values
solution
stringlengths
23
804
Write SQL query to solve given problem: How many female customers have an education level of over 11?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT COUNT(ID) FROM Customers WHERE EDUCATIONNUM > 11 AND SEX = 'Female'
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: Please list the occupations of the customers over 40 and have sent a true response to the incentive mailing sent by the marketing department.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: Among the male customers, how many of them come from a place with over 30,000 inhabitants?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: How many customers are from the place with the highest average income per month?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: Which customer come from a place with more inhabitants, customer no.0 or customer no.1?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: Among the customers who come from the place with 25746 inhabitants, how many of them are male?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: What is the average education level of customers from the place with the highest average income per month?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: What is the average age of first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT AVG(T1.age) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T2.RESPONSE = 'true'
Write SQL query to solve given problem: List down the customer's geographic identifier who are handlers or cleaners.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT GEOID FROM Customers WHERE OCCUPATION = 'Handlers-cleaners'
Write SQL query to solve given problem: What is the total number of customers with an age below 30?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT COUNT(ID) FROM Customers WHERE age < 30
Write SQL query to solve given problem: List down the geographic identifier with an income that ranges from 2100 to 2500.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT GEOID FROM Demog WHERE INCOME_K >= 2100 AND INCOME_K <= 2500
Write SQL query to solve given problem: In geographic identifier from 20 to 50, how many of them has a number of inhabitants below 20?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT COUNT(GEOID) FROM Demog WHERE INHABITANTS_K < 20 AND GEOID >= 20 AND GEOID <= 50
Write SQL query to solve given problem: What is the number of inhabitants and income of geographic identifier 239?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT INHABITANTS_K FROM Demog WHERE GEOID = 239
Write SQL query to solve given problem: Give the level of education and occupation of customers ages from 20 to 35 with an income K of 2000 and below.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: List down the number of inhabitants of customers with a divorced marital status and older than 50 years old.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: What is the geographic identifier and income of the oldest customer?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: Among the male customers with an level of education of 4 and below, list their income K.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT INCOME_K FROM Demog WHERE GEOID IN ( SELECT GEOID FROM Customers WHERE EDUCATIONNUM < 4 AND SEX = 'Male' )
Write SQL query to solve given problem: List the occupation and income of male customers with an level of education of 4 to 6.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: In widowed male customers ages from 40 to 60, how many of them has an income ranges from 3000 and above?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: What is the occupation of customers within number of inhabitants ranges of 30 to 40?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: Among the widowed female customers, give the income of those who has an level of education of 5 and below.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT INCOME_K FROM Demog WHERE GEOID IN ( SELECT GEOID FROM Customers WHERE EDUCATIONNUM < 5 AND SEX = 'Female' AND MARITAL_STATUS = 'Widowed' )
Write SQL query to solve given problem: List the marital status of customers within the age of 40 to 60 that has the highest income among the group.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: What is the number of inhabitants of male customers ages from 20 to 30 years old who are farming or fishing?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: In female customers ages from 50 to 60, how many of them has an number of inhabitants ranges from 19 to 24?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: List the income and number of inhabitants of customers with an age greater than the 80% of average age of all customers?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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)
Write SQL query to solve given problem: In customers with marital status of never married, what is the percentage of customers with income of 2500 and above?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: Find and list the id and geographic ID of the elderly customers with an education level below 3.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT ID, GEOID FROM Customers WHERE EDUCATIONNUM < 3 AND age > 65
Write SQL query to solve given problem: Calculate the number of customers who did not respond in February of 2007.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT COUNT(REFID) custmoer_number FROM Mailings1_2 WHERE RESPONSE = 'false' AND REF_DATE BETWEEN '2007-02-01' AND '2007-02-28'
Write SQL query to solve given problem: How many teenagers are working as Machine-op-inspct?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT COUNT(ID) teenager_number FROM Customers WHERE OCCUPATION = 'Machine-op-inspct' AND age >= 13 AND age <= 19
Write SQL query to solve given problem: Of customers who provide other services, how many are from places where inhabitants are more than 20000?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: Among the male customer in their twenties, how many are from places where the average income is more than 3000?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: What percentage of elderly customers who are never married in the place with geographic ID 24?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: Among the customers with an average income per inhabitant above 3000, what percentage are in their eighties?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: How many of the customer's reference ID that has a TRUE response?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT COUNT(REFID) FROM Mailings1_2 WHERE RESPONSE = 'true'
Write SQL query to solve given problem: List down the customer's reference ID with true response.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT REFID FROM Mailings1_2 WHERE RESPONSE = 'true'
Write SQL query to solve given problem: What is the total number of widowed customers with an age below 50?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT COUNT(ID) FROM Customers WHERE MARITAL_STATUS = 'Widowed' AND age < 50
Write SQL query to solve given problem: List down the geographic identifier with an number of inhabitants less than 30.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT GEOID FROM Demog WHERE INHABITANTS_K < 30
Write SQL query to solve given problem: In geographic identifier from 10 to 30, how many of them has an income below 2000?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT COUNT(GEOID) FROM Demog WHERE INCOME_K < 2000 AND GEOID >= 10 AND GEOID <= 30
Write SQL query to solve given problem: What is the marital status of the customer ages 62 with an level of education of 7?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT DISTINCT MARITAL_STATUS FROM Customers WHERE EDUCATIONNUM = 7 AND age = 62
Write SQL query to solve given problem: List down the number of inhabitants of customers with a widowed marital status and false response .. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: What is the response and number of inhabitants of the oldest female customer?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: Among the female customers with an level of education of 3 and below, list their income.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT INCOME_K FROM Demog WHERE GEOID IN ( SELECT GEOID FROM Customers WHERE EDUCATIONNUM < 3 AND SEX = 'Female' )
Write SQL query to solve given problem: List the level of education and income of customers ages from 30 to 55 with a true response.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: In male customers ages from 30 to 50, how many of them has an income ranges from 2000 to 2300?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: List the educationnum and response of customers within the age of 20 to 30 that has the highest number of inhabitants among the group.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: What is the income of female customers ages from 30 to 55 years old and has an occupation of machine-op-inspct?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: List the marital status and response of female customers with an level of education of 8 and above.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: What is the age of female customers within the number of inhabitants below 30?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT age FROM Customers WHERE GEOID IN ( SELECT GEOID FROM Demog WHERE INHABITANTS_K < 30 ) AND SEX = 'Female'
Write SQL query to solve given problem: Among the divorced male customers, give the income and response of those who has an level of education of 6 and above.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: What is the occupation and response of female customers within the number of inhabitants range of 20 to 25?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: In male customers with an occupation handlers or cleaners, what is the percentage of customers with a true response?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: List the income and number of inhabitants of customers with a reference ID greater than the 50% of average of number of false response?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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 )
Write SQL query to solve given problem: What is the ratio of male and female among the age of teenager when the education is above 10?. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: What is the geographic ID and total income per year when the average income is above 3300 dollar.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT GEOID, INHABITANTS_K * INCOME_K * 12 FROM Demog WHERE INCOME_K > 3300
Write SQL query to solve given problem: Point out the greater one between the number of actual responding and not responding to mailing.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT RESPONSE FROM Mailings1_2 GROUP BY RESPONSE ORDER BY COUNT(RESPONSE) DESC LIMIT 1
Write SQL query to solve given problem: Find out the yearly income of geographic ID when the customer is female and occupation as sales.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: Among the geographic ID which has 33.658K of inhabitants, describe the education, occupation and age of female widow.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: Find the response status to customer whose geographic ID of 134.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
SELECT T2.RESPONSE FROM Customers AS T1 INNER JOIN mailings3 AS T2 ON T1.ID = T2.REFID WHERE T1.GEOID = 134
Write SQL query to solve given problem: Describe the average income per month and yearly income of the geographic ID in which customer of ID "209556" and "290135".. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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
Write SQL query to solve given problem: Among the reference ID of under 10 who got response by marketing department, compare their education status.. Keep the solution inside sql tag ```sql [SQL-Query] ```
software_company
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'
Write SQL query to solve given problem: How many community areas are there in Central Chicago?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT COUNT(*) FROM Community_Area WHERE side = 'Central'
Write SQL query to solve given problem: Which district is the community area Lincoln Square grouped into?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT side FROM Community_Area WHERE community_area_name = 'Lincoln Square'
Write SQL query to solve given problem: Which district in Chicago has the most community areas?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT side FROM Community_Area GROUP BY side ORDER BY COUNT(side) DESC LIMIT 1
Write SQL query to solve given problem: Which community area has the least population?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT community_area_name FROM Community_Area ORDER BY population ASC LIMIT 1
Write SQL query to solve given problem: Who is the person responsible for the crime cases in Central Chicago?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT commander FROM District WHERE district_name = 'Central'
Write SQL query to solve given problem: What is the email address to contact the administrator of Central Chicago?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT email FROM District WHERE district_name = 'Central'
Write SQL query to solve given problem: To which community area does the neighborhood Albany Park belong?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
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'
Write SQL query to solve given problem: How many neighborhoods are there in the community area of Lincoln Square?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
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
Write SQL query to solve given problem: Please list the names of all the neighborhoods in the community area with the most population.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
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
Write SQL query to solve given problem: Please list the names of all the neighborhoods in Central Chicago.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
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'
Write SQL query to solve given problem: Please list the precise location coordinates of all the crimes in Central Chicago.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
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'
Write SQL query to solve given problem: How many crimes had happened in Central Chicago?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT COUNT(*) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central'
Write SQL query to solve given problem: Among all the crimes that had happened in Central Chicago, how many of them were cases of domestic violence?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
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'
Write SQL query to solve given problem: Please list the case numbers of all the crimes with no arrest made in Central Chicago.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
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'
Write SQL query to solve given problem: How many crimes had happened in the community area with the most population?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
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
Write SQL query to solve given problem: Among the crimes in Woodlawn, how many of them happened in January, 2018?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT SUM(CASE WHEN T1.community_area_name = 'Woodlawn' THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no WHERE T2.date LIKE '%1/2018%'
Write SQL query to solve given problem: More crimes happened in which community area in January, 2018, Woodlawn or Lincoln Square?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT T1.community_area_name FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no WHERE T1.community_area_name IN ('Woodlawn', 'Lincoln Square') AND T2.date LIKE '%1/2018%' GROUP BY T1.community_area_name ORDER BY COUNT(T1.community_area_name) DESC LIMIT 1
Write SQL query to solve given problem: What is the fax number for the district with the most number of crimes in January, 2018?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT T1.fax FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T2.date LIKE '%1/2018%' GROUP BY T2.district_no ORDER BY COUNT(case_number) DESC LIMIT 1
Write SQL query to solve given problem: What is the average number of crimes in a neighborhood in Central Chicago?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT CAST(COUNT(T1.report_no) AS REAL) / COUNT(T2.community_area_no) FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T1.community_area_no = T2.community_area_no WHERE T2.side = 'Central'
Write SQL query to solve given problem: Among the crimes in all the districts in Chicago, what is the percentage of them happening in the Central district?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT CAST(SUM(CASE WHEN T2.district_name = 'Central' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.case_number) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no
Write SQL query to solve given problem: How many community areas are in the Far North side?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT COUNT(*) FROM Community_Area WHERE side = 'Far North '
Write SQL query to solve given problem: Who is the commander of Morgan Park district?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT commander FROM District WHERE district_name = 'Morgan Park'
Write SQL query to solve given problem: Where did case No. JB100065 happen? Give the name of the district.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT T1.district_name FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T2.case_number = 'JB100065'
Write SQL query to solve given problem: Where is the coordinate (41.66236555, -87.63470194) located? Give the name of the district.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT T2.district_name FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T1.longitude = '-87.63470194' AND T1.latitude = '41.66236555'
Write SQL query to solve given problem: Give the name of the person who was responsible for case No.JB524952.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT T1.commander FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T2.case_number = 'JB524952'
Write SQL query to solve given problem: How many simple assaults happened on 2018/9/8?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT SUM(CASE WHEN T2.secondary_description = 'SIMPLE' THEN 1 ELSE 0 END) FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.date LIKE '%9/8/2018%' AND T2.primary_description = 'ASSAULT'
Write SQL query to solve given problem: Which district had the most number of first degree murders? Give the district number.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT T2.district_no FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.secondary_description = 'FIRST DEGREE MURDER' GROUP BY T2.district_no ORDER BY COUNT(*) DESC LIMIT 1
Write SQL query to solve given problem: How severe was case JB296775? Give the index code for severity.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT T2.iucr_no FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.case_number = 'JB296775'
Write SQL query to solve given problem: Give the name of the community area which had the most pocket-picking thefts.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT T3.community_area_name FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no INNER JOIN Community_Area AS T3 ON T2.community_area_no = T3.community_area_no WHERE T1.primary_description = 'THEFT' AND T1.secondary_description = 'POCKET-PICKING' GROUP BY T2.community_area_no ORDER BY T2.case_number DESC LIMIT 1
Write SQL query to solve given problem: Who was the alderman of the legislative district where case No. JB103470 took place? Give the full name.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT T1.alderman_first_name, T1.alderman_last_name FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.case_number = 'JB103470'
Write SQL query to solve given problem: Give the neighborhood name of West Englewood community.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT T1.neighborhood_name FROM Neighborhood AS T1 INNER JOIN Community_Area AS T2 ON T1.community_area_no = T2.community_area_no WHERE T2.community_area_name = 'West Englewood'
Write SQL query to solve given problem: How many different neighborhoods are there in Roseland community?. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT SUM(CASE WHEN T1.community_area_name = 'Roseland' THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no
Write SQL query to solve given problem: Give the FBI code description of case No.JB134191.. Keep the solution inside sql tag ```sql [SQL-Query] ```
chicago_crime
SELECT description FROM Crime AS T1 INNER JOIN FBI_Code AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T1.case_number = 'JB134191'