context
stringlengths 11
9.12k
| question
stringlengths 0
1.06k
| SQL
stringlengths 2
4.44k
| source
stringclasses 28
values |
---|---|---|---|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Among the customers who come from the place with 25746 inhabitants, how many of them are 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'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
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?
|
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'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the average education level of customers from the place with the highest average income per month?
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the average age of first 60,000 customers who sent a true response to the incentive mailing sent by the marketing department?
|
SELECT AVG(T1.age) FROM Customers AS T1 INNER JOIN Mailings1_2 AS T2 ON T1.ID = T2.REFID WHERE T2.RESPONSE = 'true'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
How many of the customers are male?
|
SELECT COUNT(ID) FROM Customers WHERE SEX = 'Male'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List down the customer's geographic identifier who are handlers or cleaners.
|
SELECT GEOID FROM Customers WHERE OCCUPATION = 'Handlers-cleaners'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the total number of customers with an age below 30?
|
SELECT COUNT(ID) FROM Customers WHERE age < 30
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List down the geographic identifier with an income that ranges from 2100 to 2500.
|
SELECT GEOID FROM Demog WHERE INCOME_K >= 2100 AND INCOME_K <= 2500
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
In geographic identifier from 20 to 50, how many of them has a number of inhabitants below 20?
|
SELECT COUNT(GEOID) FROM Demog WHERE INHABITANTS_K < 20 AND GEOID >= 20 AND GEOID <= 50
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the number of inhabitants and income of geographic identifier 239?
|
SELECT INHABITANTS_K FROM Demog WHERE GEOID = 239
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Give the level of education and occupation of customers ages from 20 to 35 with an income K of 2000 and below.
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List down the number of inhabitants of customers with a divorced marital status and older than 50 years old.
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the geographic identifier and income of the oldest customer?
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Among the male customers with an level of education of 4 and below, list their income K.
|
SELECT INCOME_K FROM Demog WHERE GEOID IN ( SELECT GEOID FROM Customers WHERE EDUCATIONNUM < 4 AND SEX = 'Male' )
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List the occupation and income of male customers with an level of education of 4 to 6.
|
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'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
In widowed male customers ages from 40 to 60, how many of them has an income ranges from 3000 and above?
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the occupation of customers within number of inhabitants ranges of 30 to 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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Among the widowed female customers, give the income of those who has an level of education of 5 and below.
|
SELECT INCOME_K FROM Demog WHERE GEOID IN ( SELECT GEOID FROM Customers WHERE EDUCATIONNUM < 5 AND SEX = 'Female' AND MARITAL_STATUS = 'Widowed' )
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List the marital status of customers within the age of 40 to 60 that has the highest income among the group.
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the number of inhabitants of male customers ages from 20 to 30 years old who are farming or fishing?
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
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.
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
In female customers ages from 50 to 60, how many of them has an number of inhabitants ranges from 19 to 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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List the income and number of inhabitants of customers with an age greater than the 80% of average age of all customers?
|
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)
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
In customers with marital status of never married, what is the percentage of customers with income of 2500 and above?
|
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'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Find and list the id and geographic ID of the elderly customers with an education level below 3.
|
SELECT ID, GEOID FROM Customers WHERE EDUCATIONNUM < 3 AND age > 65
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List the geographic id of places where the income is above average.
|
SELECT AVG(INCOME_K) FROM Demog
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Calculate the number of customers who did not respond in February of 2007.
|
SELECT COUNT(REFID) custmoer_number FROM Mailings1_2 WHERE RESPONSE = 'false' AND REF_DATE BETWEEN '2007-02-01' AND '2007-02-28'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
How many teenagers are working as Machine-op-inspct?
|
SELECT COUNT(ID) teenager_number FROM Customers WHERE OCCUPATION = 'Machine-op-inspct' AND age >= 13 AND age <= 19
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Of customers who provide other services, how many are from places where inhabitants are more than 20000?
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Among the male customer in their twenties, how many are from places where the average income is more than 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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What percentage of elderly customers who are never married in the place with geographic ID 24?
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Among the customers with an average income per inhabitant above 3000, what percentage are in their eighties?
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
How many of the customer's reference ID that has a TRUE response?
|
SELECT COUNT(REFID) FROM Mailings1_2 WHERE RESPONSE = 'true'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List down the customer's reference ID with true response.
|
SELECT REFID FROM Mailings1_2 WHERE RESPONSE = 'true'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the total number of widowed customers with an age below 50?
|
SELECT COUNT(ID) FROM Customers WHERE MARITAL_STATUS = 'Widowed' AND age < 50
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List down the geographic identifier with an number of inhabitants less than 30.
|
SELECT GEOID FROM Demog WHERE INHABITANTS_K < 30
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
In geographic identifier from 10 to 30, how many of them has an income below 2000?
|
SELECT COUNT(GEOID) FROM Demog WHERE INCOME_K < 2000 AND GEOID >= 10 AND GEOID <= 30
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the marital status of the customer ages 62 with an level of education of 7?
|
SELECT DISTINCT MARITAL_STATUS FROM Customers WHERE EDUCATIONNUM = 7 AND age = 62
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List down the number of inhabitants of customers with a widowed marital status and false response .
|
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'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the response and number of inhabitants of the oldest female customer?
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Among the female customers with an level of education of 3 and below, list their income.
|
SELECT INCOME_K FROM Demog WHERE GEOID IN ( SELECT GEOID FROM Customers WHERE EDUCATIONNUM < 3 AND SEX = 'Female' )
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List the level of education and income of customers ages from 30 to 55 with a true response.
|
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'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
In male customers ages from 30 to 50, how many of them has an income ranges from 2000 to 2300?
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List the educationnum and response of customers within the age of 20 to 30 that has the highest number of inhabitants among the group.
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the income of female customers ages from 30 to 55 years old and has an occupation of machine-op-inspct?
|
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'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List the marital status and response of female customers with an level of education of 8 and above.
|
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'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the age of female customers within the number of inhabitants below 30?
|
SELECT age FROM Customers WHERE GEOID IN ( SELECT GEOID FROM Demog WHERE INHABITANTS_K < 30 ) AND SEX = 'Female'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Among the divorced male customers, give the income and response of those who has an level of education of 6 and above.
|
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'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the occupation and response of female customers within the number of inhabitants range of 20 to 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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
In male customers with an occupation handlers or cleaners, what is the percentage of customers with a true response?
|
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'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
List the income and number of inhabitants of customers with a reference ID greater than the 50% of average of number of false response?
|
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 )
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the ratio of male and female among the age of teenager when the education is above 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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
What is the geographic ID and total income per year when the average income is above 3300 dollar.
|
SELECT GEOID, INHABITANTS_K * INCOME_K * 12 FROM Demog WHERE INCOME_K > 3300
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Point out the greater one between the number of actual responding and not responding to mailing.
|
SELECT RESPONSE FROM Mailings1_2 GROUP BY RESPONSE ORDER BY COUNT(RESPONSE) DESC LIMIT 1
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Find out the yearly income of geographic ID when the customer is female and occupation as sales.
|
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'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Among the geographic ID which has 33.658K of inhabitants, describe the education, occupation and age of female widow.
|
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'
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Find the response status to customer whose geographic ID of 134.
|
SELECT T2.RESPONSE FROM Customers AS T1 INNER JOIN mailings3 AS T2 ON T1.ID = T2.REFID WHERE T1.GEOID = 134
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Describe the average income per month and yearly income of the geographic ID in which customer of ID "209556" and "290135".
|
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
|
bird
|
CREATE TABLE software_company (GEOID integer, INHABITANTS_K real, INCOME_K real, A_VAR1 real, A_VAR2 real, A_VAR3 real, A_VAR4 real, A_VAR5 real, A_VAR6 real, A_VAR7 real, A_VAR8 real, A_VAR9 real, A_VAR10 real, A_VAR11 real, A_VAR12 real, A_VAR13 real, A_VAR14 real, A_VAR15 real, A_VAR16 real, A_VAR17 real, A_VAR18 real, REFID integer, REF_DATE datetime, RESPONSE text, ID integer, SEX text, MARITAL_STATUS text, GEOID integer, EDUCATIONNUM integer, OCCUPATION text, age integer, REFID integer, REF_DATE datetime, RESPONSE text, EVENTID integer, REFID integer, EVENT_DATE datetime, AMOUNT real)
|
Among the reference ID of under 10 who got response by marketing department, compare their education status.
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
How many community areas are there in Central Chicago?
|
SELECT COUNT(*) FROM Community_Area WHERE side = 'Central'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Which district is the community area Lincoln Square grouped into?
|
SELECT side FROM Community_Area WHERE community_area_name = 'Lincoln Square'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Which district in Chicago has the most community areas?
|
SELECT side FROM Community_Area GROUP BY side ORDER BY COUNT(side) DESC LIMIT 1
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Which community area has the least population?
|
SELECT community_area_name FROM Community_Area ORDER BY population ASC LIMIT 1
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Who is the person responsible for the crime cases in Central Chicago?
|
SELECT commander FROM District WHERE district_name = 'Central'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
What is the email address to contact the administrator of Central Chicago?
|
SELECT email FROM District WHERE district_name = 'Central'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
To which community area does the neighborhood Albany Park belong?
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
How many neighborhoods are there in the community area of 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
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Please list the names of all the neighborhoods in the community area with the most 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
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Please list the names of all the neighborhoods in Central Chicago.
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Please list the precise location coordinates of all the crimes in Central Chicago.
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
How many crimes had happened in Central Chicago?
|
SELECT COUNT(*) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Central'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Among all the crimes that had happened in Central Chicago, how many of them were cases of domestic violence?
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Please list the case numbers of all the crimes with no arrest made in Central Chicago.
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
How many crimes had happened in the community area with the most 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
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Among the crimes in Woodlawn, how many of them happened in January, 2018?
|
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%'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
More crimes happened in which community area in January, 2018, Woodlawn or Lincoln Square?
|
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
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
What is the fax number for the district with the most number of crimes in January, 2018?
|
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
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
What is the average number of crimes in a neighborhood in Central Chicago?
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Among the crimes in all the districts in Chicago, what is the percentage of them happening in the Central district?
|
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
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
How many community areas are in the Far North side?
|
SELECT COUNT(*) FROM Community_Area WHERE side = 'Far North '
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Who is the commander of Morgan Park district?
|
SELECT commander FROM District WHERE district_name = 'Morgan Park'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Where did case No. JB100065 happen? Give the name of the district.
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Where is the coordinate (41.66236555, -87.63470194) located? Give the name of the district.
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Give the name of the person who was responsible for case No.JB524952.
|
SELECT T1.commander FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T2.case_number = 'JB524952'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
How many simple assaults happened on 2018/9/8?
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Which district had the most number of first degree murders? Give the district number.
|
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
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
How severe was case JB296775? Give the index code for severity.
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Give the name of the community area which had the most pocket-picking thefts.
|
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
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Who was the alderman of the legislative district where case No. JB103470 took place? Give the full name.
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Give the neighborhood name of West Englewood community.
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
How many different neighborhoods are there in Roseland community?
|
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
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Give the FBI code description of case No.JB134191.
|
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'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
Tell the number of cases with arrests in North Lawndale community.
|
SELECT SUM(CASE WHEN T1.community_area_name = 'North Lawndale' 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.arrest = 'TRUE'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
What is the percentage of under $500 thefts among all cases that happened in West Englewood?
|
SELECT CAST(SUM(CASE WHEN T2.secondary_description = '$500 AND UNDER' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.case_number) FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no INNER JOIN Community_Area AS T3 ON T1.community_area_no = T3.community_area_no WHERE T2.primary_description = 'THEFT' AND T3.community_area_name = 'West Englewood'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
What is the percentage of larceny cases among all cases that happened in Edgewater community?
|
SELECT CAST(SUM(CASE WHEN T3.title = 'Larceny' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.case_number) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T1.community_area_name = 'Edgewater'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
How many crimes were committed at 018XX S KOMENSKY AVEin May 2018?
|
SELECT SUM(CASE WHEN date LIKE '5/%/2018%' THEN 1 ELSE 0 END) FROM Crime WHERE block = '018XX S KOMENSKY AVE'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
What is the name of the community with the highest population?
|
SELECT community_area_name FROM Community_Area ORDER BY population DESC LIMIT 1
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
How many incidents of domestic violence occurred in an abandoned building in 2018?
|
SELECT SUM(CASE WHEN location_description = 'ABANDONED BUILDING' THEN 1 ELSE 0 END) FROM Crime WHERE date LIKE '%2018%' AND domestic = 'TRUE'
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
What is the population of the district with the least population?
|
SELECT SUM(population) FROM Community_Area GROUP BY side ORDER BY SUM(population) LIMIT 1
|
bird
|
CREATE TABLE chicago_crime (community_area_no integer, community_area_name text, side text, population text, district_no integer, district_name text, address text, zip_code integer, commander text, email text, phone text, fax text, tty text, twitter text, fbi_code_no text, title text, description text, crime_against text, iucr_no text, primary_description text, secondary_description text, index_code text, neighborhood_name text, community_area_no integer, ward_no integer, alderman_first_name text, alderman_last_name text, alderman_name_suffix text, ward_office_address text, ward_office_zip text, ward_email text, ward_office_phone text, ward_office_fax text, city_hall_office_room integer, city_hall_office_phone text, city_hall_office_fax text, Population integer, report_no integer, case_number text, date text, block text, iucr_no text, location_description text, arrest text, domestic text, beat integer, district_no integer, ward_no integer, community_area_no integer, fbi_code_no text, latitude text, longitude text)
|
How many arrests were made in 2018 in an animal hospital under FBI code 08B?
|
SELECT SUM(CASE WHEN arrest = 'TRUE' THEN 1 ELSE 0 END) FROM Crime WHERE date LIKE '%2018%' AND location_description = 'ANIMAL HOSPITAL' AND fbi_code_no = '08B'
|
bird
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.