db_id
stringclasses
68 values
question
stringlengths
33
321
evidence
stringlengths
0
673
SQL
stringlengths
116
743
question_id
int64
3
6.6k
difficulty
stringclasses
2 values
books
Among the books published in 2004, list the name of the publisher of books with number of pages greater than 70% of the average number of pages of all books.
published in 2004 refers to publication_date LIKE '2004%'; books with number of pages greater than 70% of the average number of pages refers to num_pages > Multiply(Avg(num_pages), 0.7); name of publisher refers to publisher_name
SELECT T1.title, T2.publisher_name FROM book AS T1 INNER JOIN publisher AS T2 ON T1.publisher_id = T2.publisher_id WHERE STRFTIME('%Y', T1.publication_date) = '2004' AND T1.num_pages * 100 > ( SELECT AVG(num_pages) FROM book ) * 70
1,411
challenging
books
Among all addresses provided by customers, identify the percentage that are not in use anymore.
address not in use refers to address_status = 'Inactive'; percentage = Divide (Count(address_status = 'Inactive'), Count(address_status)) * 100
SELECT CAST(SUM(CASE WHEN T2.address_status = 'Inactive' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM customer_address AS T1 INNER JOIN address_status AS T2 ON T2.status_id = T1.status_id
3,196
moderate
books
Among Daisey Lamball's orders, how many were shipped via International shipping?
via international shipping refers to method_name = 'International'
SELECT COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Daisey' AND T1.last_name = 'Lamball' AND T3.method_name = 'International'
759
moderate
books
What is the average of English books among all books published by Carole Marsh Mysteries?
English book refers to language_name = 'English'; 'Carole Marsh Mysteries' is the publisher_name; average = Divide (Count(language_name = 'English'), Count(book_id))
SELECT CAST(SUM(CASE WHEN T1.language_name = 'English' THEN 1 ELSE 0 END) AS REAL) / COUNT(*) FROM book_language AS T1 INNER JOIN book AS T2 ON T1.language_id = T2.language_id INNER JOIN publisher AS T3 ON T3.publisher_id = T2.publisher_id WHERE T3.publisher_name = 'Carole Marsh Mysteries'
5,026
challenging
books
What is the sum of the number of pages of the books ordered by Mick Sever?
sum of the number of pages refers to Sum(num_pages)
SELECT SUM(T1.num_pages) FROM book AS T1 INNER JOIN order_line AS T2 ON T1.book_id = T2.book_id INNER JOIN cust_order AS T3 ON T3.order_id = T2.order_id INNER JOIN customer AS T4 ON T4.customer_id = T3.customer_id WHERE T4.first_name = 'Mick' AND T4.last_name = 'Sever'
504
moderate
books
What percentage of the total prices of all orders are shipped internationally?
shipped internationally refers to method_name = 'International'; percentage = Divide (Sum(price where method_name = 'International'), Sum(price)) * 100
SELECT CAST(SUM(CASE WHEN T3.method_name = 'International' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM cust_order AS T1 INNER JOIN order_line AS T2 ON T1.order_id = T2.order_id INNER JOIN shipping_method AS T3 ON T3.method_id = T1.shipping_method_id
5,321
moderate
books
How many orders did Marcelia Goering place in 2021 that uses the Priority Shipping method?
in 2021 refers to substr(order_date, 1, 4) = '2021'; priority shipping method refers to method_name = 'Priority'
SELECT COUNT(*) FROM customer AS T1 INNER JOIN cust_order AS T2 ON T1.customer_id = T2.customer_id INNER JOIN shipping_method AS T3 ON T3.method_id = T2.shipping_method_id WHERE T1.first_name = 'Marcelia' AND T1.last_name = 'Goering' AND STRFTIME('%Y', T2.order_date) = '2021' AND T3.method_name = 'Priority'
3,756
moderate
books
List the author's and publisher's name of the book published on July 10, 1997.
author's name refers to author_name; publisher's name refers to publisher_name; book published on July 10, 1997 refers to publication_date LIKE '1997-07-10'
SELECT T3.author_name, T4.publisher_name FROM book AS T1 INNER JOIN book_author AS T2 ON T1.book_id = T2.book_id INNER JOIN author AS T3 ON T3.author_id = T2.author_id INNER JOIN publisher AS T4 ON T4.publisher_id = T1.publisher_id WHERE T1.publication_date = '1997-07-10'
344
challenging
car_retails
List out sale rep that has sold 1969 Harley Davidson Ultimate Chopper. List out their names and quantity sold throughout the year.
1969 Harley Davidson Ultimate Chopper refers to the name of the product; sale rep refers to employee; 2003 refers to year(orderDate) = 2003; quantity sold refers to quantityOrdered; their names refer to the name of customers;
SELECT t5.firstName, t5.lastName, SUM(t2.quantityOrdered) FROM products AS t1 INNER JOIN orderdetails AS t2 ON t1.productCode = t2.productCode INNER JOIN orders AS t3 ON t2.orderNumber = t3.orderNumber INNER JOIN customers AS t4 ON t3.customerNumber = t4.customerNumber INNER JOIN employees AS t5 ON t4.salesRepEmployeeNumber = t5.employeeNumber WHERE t1.productName = '1969 Harley Davidson Ultimate Chopper' GROUP BY t5.lastName, t5.firstName
3,357
challenging
car_retails
List out 3 best seller products during year 2003 with their total quantity sold during 2003.
Best selling products refer to products with MAX(quantityOrdered); 2003 refers to year(orderDate) = 2003;
SELECT t3.productName, SUM(t2.quantityOrdered) FROM orders AS t1 INNER JOIN orderdetails AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN products AS t3 ON t2.productCode = t3.productCode WHERE STRFTIME('%Y', t1.orderDate) = '2003' GROUP BY t3.productName ORDER BY SUM(t2.quantityOrdered) DESC LIMIT 3
3,334
moderate
car_retails
Which two products has the highest and lowest expected profits? Determine the total price for each product in terms of the largest quantity that was ordered.
expected profits = SUBTRACT(msrp, buyPrice); total price = MULTIPLY(quantityOrdered, priceEach)
SELECT T2.productName, SUM(T1.quantityOrdered * T1.priceEach) FROM orderdetails AS T1 INNER JOIN ( SELECT productCode, productName FROM products ORDER BY MSRP - buyPrice DESC LIMIT 1 ) AS T2 ON T1.productCode = T2.productCode UNION SELECT T2.productName, SUM(quantityOrdered * priceEach) FROM orderdetails AS T1 INNER JOIN ( SELECT productCode, productName FROM products ORDER BY MSRP - buyPrice ASC LIMIT 1 ) AS T2 ON T1.productCode = T2.productCode
5,488
challenging
car_retails
Between 8/1/2003 and 8/30/2004, how many checks were issued by Mini Gifts Distributors Ltd.? Please list their check numbers.
paymentDate BETWEEN '2003-08-01' AND '2004-08-30'; Mini Gifts Distributors Ltd. Is a customer name;
SELECT T1.checkNumber FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.paymentDate >= '2003-08-01' AND T1.paymentDate <= '2004-08-30' AND T2.customerName = 'Mini Gifts Distributors Ltd.'
4,349
moderate
car_retails
Among all orders shipped, calculate the percentage of orders shipped at least 3 days before the required date.
Orders shipped refer to status = 'Shipped'; at least 3 days before the required date refers to SUBTRACT(shippedDate, requiredDate)>3; DIVIDE(COUNT(orderNumber where SUBTRACT(shippedDate, requiredDate)>3), (COUNT(orderNumber) as percentage;
SELECT COUNT(CASE WHEN JULIANDAY(t1.shippeddate) - JULIANDAY(t1.requireddate) > 3 THEN T1.customerNumber ELSE NULL END) FROM orders AS T1 INNER JOIN orderdetails AS T2 ON T1.orderNumber = T2.orderNumber WHERE T1.status = 'Shipped'
4,832
moderate
car_retails
Among the motorcycles with product scale of 1:10, which of them is the most ordered by American customers?
motorcycle is a product line; American is a nationality of country = 'USA';
SELECT T1.productName FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T2.orderNumber = T3.orderNumber INNER JOIN customers AS T4 ON T3.customerNumber = T4.customerNumber WHERE T1.productLine = 'Motorcycles' AND T1.productScale = '1:10' AND T4.country = 'USA' GROUP BY T1.productName ORDER BY SUM(T2.quantityOrdered) DESC LIMIT 1
1,501
moderate
car_retails
Among the customers of empolyee 1370, who has the highest credit limit?Please list the full name of the contact person.
Employee 1370 refers to employeeNumber = '1370';
SELECT t2.contactFirstName, t2.contactLastName FROM employees AS t1 INNER JOIN customers AS t2 ON t1.employeeNumber = t2.salesRepEmployeeNumber WHERE t1.employeeNumber = '1370' ORDER BY t2.creditLimit DESC LIMIT 1
52
moderate
car_retails
Compared with the orders happened on 2005-04-08 and two days later, which day's order had a higher value?
2005-04-08 and two days later refer to orderDate = '2005-04-08' and orderDate = '2005-04-10'; order with a higher value refers to MAX(Total price) = MULTIPLY(quantityOrdered, priceEach);
SELECT T2.orderDate FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE STRFTIME('%Y-%m-%d', T2.orderDate) = '2005-04-08' OR STRFTIME('%Y-%m-%d', T2.orderDate) = '2005-04-10' ORDER BY T1.quantityOrdered * T1.priceEach DESC LIMIT 1
4,580
challenging
car_retails
What is the highest amount of order made by the sales representative in Boston? Please give the name of the product and amount.
Boston is a city; amount of order = MULTIPLY(quantityOrdered, priceEach);
SELECT T2.productName, T1.quantityOrdered * T1.priceEach FROM orderdetails AS T1 INNER JOIN products AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T1.orderNumber = T3.orderNumber INNER JOIN customers AS T4 ON T3.customerNumber = T4.customerNumber WHERE T4.city = 'Boston' AND T4.salesRepEmployeeNumber IN ( SELECT employeeNumber FROM employees WHERE jobTitle = 'Sales Rep' ) ORDER BY T1.quantityOrdered DESC LIMIT 1
2,005
moderate
car_retails
Calculate the total quantity ordered for 18th Century Vintage Horse Carriage and the average price.
18th Century Vintage Horse Carriage is a product name; average price = AVG(priceEach);
SELECT SUM(T2.quantityOrdered) , SUM(T2.quantityOrdered * T2.priceEach) / SUM(T2.quantityOrdered) FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode WHERE T1.productName = '18th Century Vintage Horse Carriage'
5,233
moderate
car_retails
What is the percentage of the payment amount in 2004 was made by Atelier graphique?
DIVIDE(SUM(amount) where customerName = 'Atelier graphique'), (SUM(amount)) as percentage where year(paymentDate) = 2004;
SELECT SUM(CASE WHEN t1.customerName = 'Atelier graphique' THEN t2.amount ELSE 0 END) * 100 / SUM(t2.amount) FROM customers AS t1 INNER JOIN payments AS t2 ON t1.customerNumber = t2.customerNumber WHERE STRFTIME('%Y', t2.paymentDate) = '2004'
4,908
moderate
car_retails
Which different vendor has the most amount of orders? Calculate the total estimated earnings.
amount of order refers to quantityOrdered; most amount of orders refers to SUM(QuantityOrdered); estimated earnings refers to expected profits; expected profits = SUBTRACT(msrp, buyPrice);
SELECT DISTINCT T1.productVendor, T1.MSRP - T1.buyPrice FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode GROUP BY T1.productVendor, T1.MSRP, T1.buyPrice ORDER BY COUNT(T2.quantityOrdered) DESC LIMIT 1
4,977
moderate
car_retails
Please list the phone numbers of the top 3 customers that have the highest credit limit and have Leslie Jennings as their sales representitive.
SELECT t1.phone FROM customers AS t1 INNER JOIN employees AS t2 ON t1.salesRepEmployeeNumber = t2.employeeNumber WHERE t2.firstName = 'Leslie' AND t2.lastName = 'Jennings' ORDER BY t1.creditLimit DESC LIMIT 3
5,159
moderate
car_retails
Calculate the total price of shipped orders belonging to Land of Toys Inc. under the classic car line of products.
SUM(MULTIPLY(quantityOrdered, priceEach)) where productLine = 'Classic Cars'; status = 'Shipped'; customername = 'Land of Toys Inc';
SELECT SUM(t3.priceEach * t3.quantityOrdered) FROM customers AS t1 INNER JOIN orders AS t2 ON t1.customerNumber = t2.customerNumber INNER JOIN orderdetails AS t3 ON t2.orderNumber = t3.orderNumber INNER JOIN products AS t4 ON t3.productCode = t4.productCode WHERE t4.productLine = 'Classic Cars' AND t1.customerName = 'Land of Toys Inc.' AND t2.status = 'Shipped'
6,139
moderate
car_retails
On what date did the customer with the lowest credit limit serviced by sales representative Barry Jones make payments for his/her orders?
SELECT T3.paymentDate FROM employees AS T1 INNER JOIN customers AS T2 ON T1.employeeNumber = T2.salesRepEmployeeNumber INNER JOIN payments AS T3 ON T2.customerNumber = T3.customerNumber WHERE T1.firstName = 'Barry' AND T1.lastName = 'Jones' AND T1.jobTitle = 'Sales Rep' ORDER BY T2.creditLimit ASC LIMIT 1
4,150
moderate
car_retails
Of the clients whose businesses are located in the city of Boston, calculate which of them has a higher average amount of payment.
average amount payment = AVG(amount);
SELECT T1.customerNumber FROM customers AS T1 INNER JOIN payments AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.city = 'Boston' GROUP BY T1.customerNumber ORDER BY SUM(T2.amount) / COUNT(T2.paymentDate) DESC LIMIT 1
380
moderate
car_retails
Of all the orders placed and shipped throughout the year 2005, what percentage of those orders corresponds to customer number 186?
shipped orders refers to status = 'shipped'; year(shippedDate) = 2005; percentage = DIVIDE(SUM(customerNumber = 186)), COUNT(orderNumber)) as percentage;
SELECT CAST(SUM(CASE WHEN customerNumber = 186 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(orderNumber) FROM orders WHERE status = 'Shipped' AND shippedDate BETWEEN '2005-01-01' AND '2005-12-31'
5,444
moderate
car_retails
From which branch does the sales representative employee who made the most sales in 2005? Please indicates its full address and phone number.
orderDate between '2005-01-01' and '2005-12-31'; full address = addressLine1+addressLine2;
SELECT T3.addressLine1, T3.addressLine2, T3.phone FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber INNER JOIN customers AS T3 ON T2.customerNumber = T3.customerNumber INNER JOIN employees AS T4 ON T3.salesRepEmployeeNumber = T4.employeeNumber INNER JOIN offices AS T5 ON T4.officeCode = T5.officeCode WHERE STRFTIME('%Y', T2.orderDate) = '2005' AND T4.jobTitle = 'Sales Rep' ORDER BY T1.quantityOrdered DESC LIMIT 1
2,693
moderate
car_retails
Please calculate the average total price of orders from Exoto Designs Vendor in 2005.
average total price = DIVIDE(SUM(MULTIPLY(quantityOrdered, priceEach))), COUNT(orderNumber)); year(orderDate) = '2005';
SELECT SUM(T2.quantityOrdered * T2.priceEach) / COUNT(T3.orderNumber) FROM products AS T1 INNER JOIN orderdetails AS T2 ON T1.productCode = T2.productCode INNER JOIN orders AS T3 ON T2.orderNumber = T3.orderNumber WHERE T1.productVendor = 'Exoto Designs' AND STRFTIME('%Y', T3.orderDate) = '2005'
6,041
moderate
car_retails
How many distinct orders were there in 2003 when the quantity ordered was less than 30?
year(orderDate) = '2003'; quantityOrdered < 30;
SELECT COUNT(DISTINCT T1.orderNumber) FROM orderdetails AS T1 INNER JOIN orders AS T2 ON T1.orderNumber = T2.orderNumber WHERE T1.quantityOrdered < 30 AND STRFTIME('%Y', T2.orderDate) = '2003'
2,762
moderate
car_retails
What is the full address of the customer who commented that DHL be used for the order that was shipped on April 4, 2005?
full address = addressLine1+addressLine2; shippedDate = '2005-04-04';
SELECT T1.addressLine1, T1.addressLine2 FROM customers AS T1 INNER JOIN orders AS T2 ON T1.customerNumber = T2.customerNumber WHERE T2.shippedDate = '2005-04-04' AND T2.status = 'Shipped'
3,502
moderate
car_retails
Which of the customers, whose Tokyo-based sales representative reports to the Vice President of Sales whose employee number is 1056, has paid the highest payment? List the customer's name, the contact person and calculate the total amount of that customer's total payments.
Tokyo is a city; 'reportsTO' is the leader of the 'employeeNumber'; highest payment refers to MAX(amount); total amount of payments = SUM(amount);
SELECT T2.customerName, T2.contactFirstName, T2.contactLastName, SUM(T3.amount) FROM employees AS T1 INNER JOIN customers AS T2 ON T2.salesRepEmployeeNumber = T1.employeeNumber INNER JOIN payments AS T3 ON T2.customerNumber = T3.customerNumber INNER JOIN offices AS T4 ON T1.officeCode = T4.officeCode WHERE T4.city = 'Tokyo' AND T1.reportsTo = 1056 GROUP BY T2.customerName, T2.contactFirstName, T2.contactLastName ORDER BY amount DESC LIMIT 1
6,459
challenging
car_retails
Which product did Cruz & Sons Co. order on 2003/3/3?
Cruz & Sons Co. is name of customer; 2003/3/3 refers to orderDate;
SELECT t4.productName FROM orderdetails AS t1 INNER JOIN orders AS t2 ON t1.orderNumber = t2.orderNumber INNER JOIN customers AS t3 ON t2.customerNumber = t3.customerNumber INNER JOIN products AS t4 ON t1.productCode = t4.productCode WHERE t3.customerName = 'Cruz & Sons Co.' AND t2.orderDate = '2003-03-03'
1,787
moderate
car_retails
How many customers have a credit limit of not more than 100,000 and which customer made the highest total payment amount for the year 2004?
creditLimit < = 100000; total payment amount refers to amount; highest total payment amount refers to MAX(amount); year(paymentDate) = '2004';
SELECT ( SELECT COUNT(customerNumber) FROM customers WHERE creditLimit <= 100000 AND customerNumber IN ( SELECT customerNumber FROM payments WHERE STRFTIME('%Y', paymentDate) = '2004' ) ), T1.customerName FROM customers AS T1 INNER JOIN payments AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.creditLimit <= 100000 AND STRFTIME('%Y', T2.paymentDate) = '2004' GROUP BY T1.customerNumber, T1.customerName ORDER BY SUM(T2.amount) DESC LIMIT 1
1,354
moderate
car_retails
What was the total price of the products shipped to Rovelli Gifts Distributors Ltd. between 1/1/2003 and 12/31/2003?
Mini Gifts Distributors Ltd. Is the customer name; shippedDate between '2003-01-01' and '2003-12-31'; total price = MULTIPLY(quantityOrdered, priceEach);
SELECT T3.priceEach * T3.quantityOrdered FROM customers AS T1 INNER JOIN orders AS T2 ON T1.customerNumber = T2.customerNumber INNER JOIN orderdetails AS T3 ON T2.orderNumber = T3.orderNumber WHERE T1.customerName = 'Rovelli Gifts' AND T2.status = 'Shipped' AND STRFTIME('%Y', T2.shippedDate) = '2003'
1,828
challenging
car_retails
What is the average, highest and lowest annual payments collected between 1/1/2003 to 12/31/2005?
paymentDate BETWEEN '2003-01-01' AND '2005-12-31'; average annual payments = DIVIDE(SUM(amount), 3);
SELECT CAST(SUM(T1.amount) AS REAL) / 3, MAX(T1.amount) , MIN(T1.amount) FROM payments AS T1 INNER JOIN customers AS T2 ON T1.customerNumber = T2.customerNumber WHERE T1.paymentDate BETWEEN '2003-01-01' AND '2005-12-31'
5,378
moderate
cars
Calculate the average production rate per year from 1971 to 1980. Among them, name the cars with a weight of fewer than 1800 lbs.
from 1971 to 1980 refers to model_year between 1971 and 1980; average production rate per year = divide(count(ID where model_year between 1971 and 1980), 9); car's name refers to car_name; a weight of fewer than 1800 lbs refers to weight < 1800
SELECT CAST(COUNT(T1.ID) AS REAL) / 9 FROM production AS T1 INNER JOIN data AS T2 ON T2.ID = T1.ID WHERE T1.model_year BETWEEN 1971 AND 1980 UNION ALL SELECT DISTINCT T2.car_name FROM production AS T1 INNER JOIN data AS T2 ON T2.ID = T1.ID WHERE T1.model_year BETWEEN 1971 AND 1980 AND T2.weight < 1800
2,486
moderate
cars
What is the percentage of cars that was produced by Japan among those that have a sweep volume of no less than 30?
produced by Japan refers to country = 'Japan'; a sweep volume of no less than 30 refers to divide(displacement, cylinders) > 30; percentage = divide(count(ID where country = 'Japan'), count(ID)) * 100% where divide(displacement, cylinders) > 30
SELECT CAST(SUM(CASE WHEN T3.country = 'Japan' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country WHERE T1.displacement / T1.cylinders > 30
6,549
challenging
chicago_crime
Which community area has the highest number of crimes reported on the street?
reported on the street refers to location_description = 'STREET'; community area with highest number of crime refers to Max(Count(location_description)); community area refers to community_area_no
SELECT T1.community_area_no FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T2.location_description = 'STREET' GROUP BY T1.community_area_no ORDER BY COUNT(T2.location_description) DESC LIMIT 1
4,305
moderate
chicago_crime
Among the crimes in the ward with the most population, how many of them are cases of domestic violence?
most population refers to Max(Population); domestic violence refers to domestic = 'TRUE'
SELECT COUNT(T1.ward_no) AS num FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.domestic = 'TRUE' ORDER BY T1.Population = ( SELECT Population FROM Ward ORDER BY Population DESC LIMIT 1 )
3,255
moderate
chicago_crime
Provide the occurrence date and location of the deceptive practice due to the unlawful use of recorded sound.
location refers to latitude, longitude; deceptive practice refers to primary_description = 'DECEPTIVE PRACTICE'; unlawful use of recorded sound refers to secondary_description = 'UNLAWFUL USE OF RECORDED SOUND'
SELECT T2.date, T2.latitude, T2.longitude FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no WHERE T1.primary_description = 'DECEPTIVE PRACTICE' AND T1.secondary_description = 'UNLAWFUL USE OF RECORDED SOUND'
6,184
moderate
chicago_crime
What is the total population of the neighborhoods Avondale Gardens, Irving Park, Kilbourn Park, Merchant Park, Old Irving Park, and The Villa?
"Avoladale Gardens", "Irving Park", "Kilbourn Park", "Merchant Park", "Old Irving Park", "The Villa" are neighborhood_name; total population refers to Sum(Population)
SELECT SUM(T2.population) AS sum FROM Neighborhood AS T1 INNER JOIN Community_Area AS T2 ON T1.community_area_no = T2.community_area_no WHERE T1.neighborhood_name = 'Avondale Gardens' OR T1.neighborhood_name = 'Irving Park' OR T1.neighborhood_name = 'Kilbourn Park' OR T1.neighborhood_name = 'Merchant Park' OR T1.neighborhood_name = 'Old Irving Park' OR T1.neighborhood_name = 'The Villa'
2,347
challenging
chicago_crime
In the least populated community, what is the most common location of all the reported crime incidents?
least populated refers to Min(Population); community refers to community_area_no; most common location refers to Max(Count(location_description))
SELECT T2.location_description FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no WHERE T1.population = ( SELECT MIN(population) FROM Community_Area ) AND T2.location_description IS NOT NULL GROUP BY T2.location_description
580
moderate
chicago_crime
Which district commander was responsible for more incidents in January, 2018, Robert A. Rubio or Glenn White?
in January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; 'Robert A. Rubio' and 'Glenn White' are both commander; responsible for more incident refers to Max(count(ward_no))
SELECT T1.commander FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T1.commander IN ('Robert A. Rubio', 'Glenn White') AND SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018' GROUP BY T1.commander
3,711
challenging
chicago_crime
How many severe crime incidents were reported at coordinate 41.64820151, -87.54430496?
coordinates refers to latitude, longitude; severe crime refers to index_code = 'I'
SELECT SUM(CASE WHEN T1.longitude = '-87.54430496' THEN 1 ELSE 0 END) FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.report_no = T2.iucr_no WHERE T2.index_code = 'I' AND T1.latitude = '41.64820251'
2,383
moderate
chicago_crime
Who is the commanding officer in the district with the highest number of disorderly conduct?
commanding officer refers to commander; the highest number refers to max(count(district_no)); disorderly conduct refers to title = 'Disorderly Conduct'
SELECT T1.commander FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T3.title = 'Disorderly Conduct' AND T2.fbi_code_no = 24 GROUP BY T2.fbi_code_no ORDER BY COUNT(T1.district_no) DESC LIMIT 1
5,998
moderate
chicago_crime
How many crime against society were reported in Englewood?
"Englewood" is the community_area_name; 'Society' is the crime_against
SELECT SUM(CASE WHEN T3.community_area_name = 'Englewood' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no INNER JOIN Community_Area AS T3 ON T2.community_area_no = T3.community_area_no WHERE T1.crime_against = 'Society'
6,164
moderate
chicago_crime
Among all the incidents with no arrest made, what is the percentage of them having a generic description of "BATTERY" in the IUCR classification?
incident with no arrest made refers to arrest = 'FALSE'; general description refers to primary_description; "BATTERY" is the primary_description; percentage = Divide (Count(iucr_no where primary_description = 'BATTERY'), Count(iucr_no)) * 100
SELECT CAST(SUM(CASE WHEN T1.primary_description = 'BATTERY' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*)FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T2.arrest = 'FALSE'
21
challenging
chicago_crime
List the location descriptions and aldermen's full names of the arson by explosive.
aldermen's full name refers to alderman_name_suffix, alderman_first_name, alderman_last_name; arson by explosive refers to primary_description = 'ARSON' AND secondary_description = 'BY EXPLOSIVE'
SELECT T2.location_description, T1.alderman_first_name, T1.alderman_last_name, T1.alderman_name_suffix FROM Ward AS T1 INNER JOIN Crime AS T2 ON T2.ward_no = T1.ward_no INNER JOIN IUCR AS T3 ON T3.iucr_no = T2.iucr_no WHERE T3.primary_description = 'ARSON' AND T3.secondary_description = 'BY EXPLOSIVE'
5,150
challenging
chicago_crime
Among the crimes happened in the neighborhood called "Avalon Park", what is the percentage of crimes that happened inside the house?
"Avalon Park" is the neghborhood_name; happened inside the house refers to location_description = 'HOUSE'; percentage = Divide (Count(location_description = 'HOUSE'), Count(location_description)) * 100
SELECT CAST(SUM(CASE WHEN T2.location_description = 'HOUSE' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.location_description) AS persent FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN Neighborhood AS T3 ON T2.community_area_no = T3.community_area_no WHERE T3.neighborhood_name = 'Avalon Park'
6,571
challenging
chicago_crime
Among the crimes in Woodlawn, how many of them happened in January, 2018?
Woodlawn refers to community_area_name = 'Woodlawn'; in January 2018 refers to date like '%1/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%'
1,663
moderate
chicago_crime
How many crimes were handled by Brendan Reilly on 7th October 2018?
7th October 2018 refers to date like '10/7/2018%'
SELECT SUM(CASE WHEN T2.alderman_last_name = 'Reilly' THEN 1 ELSE 0 END) FROM Crime AS T1 INNER JOIN Ward AS T2 ON T1.ward_no = T2.ward_no WHERE T2.alderman_name_suffix IS NULL AND T2.alderman_first_name = 'Brendan' AND date LIKE '10/7/2018%'
150
moderate
chicago_crime
How many weapons violation crimes have occurred in the Calumet district?
"Calumet" is the district_name; 'WEAPON VIOLATION' is the primary_description of crime
SELECT SUM(CASE WHEN T3.district_name = 'Calumet' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no WHERE T1.primary_description = 'WEAPONS VIOLATION'
3,517
moderate
chicago_crime
What percentage of non-domestic crimes have occurred in the Jefferson Park district?
non domestic crime refers to domestic = 'FALSE'; 'Jefferson Park' is the district_name; percentage = Divide (Count (case_number where domestic = 'FALSE'), Count(case_number)) * 100
SELECT CAST(COUNT(CASE WHEN T2.domestic = 'FALSE' THEN T2.case_number END) AS REAL) * 100 / COUNT(T2.case_number) FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no WHERE T1.district_name = 'Jefferson Park'
2,574
moderate
chicago_crime
Among the crimes in the Central, calculate the percentage of larceny incidents.
Central refers to side = 'Central'; larceny refers to title = 'Larceny'; percentage = divide(count(report_no where title = 'Larceny'), count(report_no)) where side = 'Central' * 100%
SELECT CAST(COUNT(CASE WHEN T3.title = 'Larceny' THEN T2.report_no END) AS REAL) * 100 / COUNT(T2.report_no) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no INNER JOIN FBI_Code AS T3 ON T3.fbi_code_no = T2.fbi_code_no WHERE T1.side = 'Central'
6,404
challenging
chicago_crime
How many arrests have been made due to forcible entry burglary that took place in a day care center?
"BURGLARY" is the primary_description; 'FORCIBLE ENTRY' is the secondary_description; 'DAY CARE CENTER' is the location_description; arrests have been made refers to arrest = 'TRUE'
SELECT SUM(CASE WHEN T2.arrest = 'TRUE' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T2.location_description = 'DAY CARE CENTER' AND T1.secondary_description = 'FORCIBLE ENTRY' AND T1.primary_description = 'BURGLARY'
1,734
moderate
chicago_crime
How many solicit on public way prostitution crimes were arrested in West Garfield Park?
solicit on public way prostitution crime refers to secondary_description = 'SOLICIT ON PUBLIC WAY' AND primary_description = 'PROSTITUTION'; arrested refers to arrest = 'TRUE'; West Garfield Park refers to community_area_name = 'West Garfield Park'
SELECT SUM(CASE WHEN T2.arrest = 'TRUE' THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN IUCR AS T3 ON T2.iucr_no = T3.iucr_no WHERE T1.community_area_name = 'West Garfield Park' AND T3.secondary_description = 'SOLICIT ON PUBLIC WAY' AND T3.primary_description = 'PROSTITUTION'
2,711
moderate
chicago_crime
In the most populated ward, how many incidents of domestic violence were reported in a bar or tavern?
the most populated refers to max(population); domestic violence refers to domestic = 'TRUE'; in a bar or tavern refers to location_description = 'BAR OR TAVERN'
SELECT COUNT(T2.report_no) FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.domestic = 'TRUE' AND T2.location_description = 'BAR OR TAVERN' ORDER BY T1.Population DESC LIMIT 1
425
moderate
chicago_crime
List the report number of crimes reported in a community area in the far north side with a population greater than 60,000.
report number refers to report_no; the far north side refers to side = 'Far North'; population greater than 60,000 refers to population > '60000'
SELECT SUM(CASE WHEN T1.population > 60000 THEN 1 ELSE 0 END) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.side = 'Far North '
1,603
moderate
chicago_crime
In Albany Park, how many arrests were made in an apartment due to criminal sexual abuse?
Albany Park refers to district_name = 'Albany Park'; in an apartment refers to location_description = 'APARTMENT'; criminal sexual abuse refers to title = 'Criminal Sexual Abuse'
SELECT SUM(CASE WHEN T3.title = 'Criminal Sexual Abuse' THEN 1 ELSE 0 END) FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T1.district_name = 'Albany Park' AND T2.arrest = 'TRUE' AND T2.location_description = 'APARTMENT'
2,127
challenging
chicago_crime
What is the average number of less severe crimes reported a day in February of 2018?
day in February of 2018 refers to date LIKE '2/%/2018'; less severe crime refers to index_code = 'N'; average = Divide (Count(case_number), 28)
SELECT CAST(COUNT(T2.case_number) AS REAL) / 28 FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no WHERE T2.date LIKE '2/%/2018%' AND T1.index_code = 'N'
2,883
moderate
chicago_crime
What is the percentage of larceny cases among all cases that happened in Edgewater community?
larceny case refers to title = 'Larceny'; Edgewater community refers to community_area_name = 'Edgewater'; percentage = divide(count(case_number where title = 'Larceny'), count(case_number)) where community_area_name = 'Edgewater' * 100%
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'
3,324
challenging
chicago_crime
What types of domestic crimes have occurred the most in the North Lawndale community?
"North Lawndale' is the community_area_name; occur the most domestic crime refers to Max(Count(domestic = 'TRUE'))
SELECT T2.domestic FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.community_area_name = 'North Lawndale' AND T2.domestic = 'TRUE' GROUP BY T2.domestic ORDER BY COUNT(T2.domestic) DESC LIMIT 1
5,278
moderate
chicago_crime
Between Deering and Near West districts, which district reported the most number of crime incidents that happened in a library?
"Deering" and "Near West" are both district_name; 'LIBRARY' is the location_description; district with the most number of crime Max(Count(district_no))
SELECT T1.district_name FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T1.district_name IN ('Deering', 'Near West') AND T2.location_description = 'LIBRARY' GROUP BY T1.district_name ORDER BY COUNT(T2.district_no) DESC LIMIT 1
6,321
moderate
chicago_crime
Calculate the percentage of the domestic violence cases handled by Christopher Taliaferro. Among them, list report numbers of cases that happened in the bank.
domestic violence refers to domestic = 'TRUE'; report number refers to report_no; in the bank refers to location_description = 'BANK'; percentage = divide(count(report_no where domestic = 'TRUE'), count(report_no)) * 100%
SELECT CAST(COUNT(CASE WHEN T1.domestic = 'TRUE' THEN T1.report_no END) AS REAL) * 100 / COUNT(T1.report_no), COUNT(CASE WHEN T1.domestic = 'TRUE' AND T1.location_description = 'BANK' THEN T1.report_no END) AS "number" FROM Crime AS T1 INNER JOIN Ward AS T2 ON T2.ward_no = T1.ward_no WHERE T2.alderman_first_name = 'Christopher' AND T2.alderman_last_name = 'Taliaferro'
2,271
challenging
chicago_crime
What is the precise coordinate of the location where simple assault incidents happened the most in Chatham?
precise coordinates refers to latitude, longitude; 'Simple Assault' is the title of incident; 'Chatham' is the community_area_name; most incident happened refers to Max(Count(latitude, longitude))
SELECT T2.latitude, T2.longitude FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no INNER JOIN Community_Area AS T3 ON T2.community_area_no = T3.community_area_no WHERE T1.title = 'Simple Assault' AND T3.community_area_name = 'Chatham' AND T3.community_area_no = 44 ORDER BY T2.latitude DESC, T2.longitude DESC LIMIT 1
1,730
moderate
chicago_crime
Among the incidents with the generic description of "BATTERY" in the IUCR classification, how many of them do not have arrests made?
general description refers to primary_description; 'BATTERY' is the primary_description; do not have arrest made refers to arrest = 'FALSE'
SELECT SUM(CASE WHEN T2.arrest = 'FALSE' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.primary_description = 'BATTERY'
653
moderate
chicago_crime
List the name and population of the communities where more than average solicit for prostitutes were reported.
"SOLICIT FOR PROSTITUTE" is the secondary_description; more than average refers to count(iucr_no) > Divide (Count(secondary_description = 'SOLICIT FOR PROSTITUTE'), Count(iucr_no)); name of community refers to community_area_name
SELECT T2.community_area_name, T2.population FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T2.community_area_no = T1.community_area_no INNER JOIN IUCR AS T3 ON T3.iucr_no = T1.iucr_no WHERE T3.iucr_no = ( SELECT iucr_no FROM IUCR WHERE secondary_description = 'SOLICIT FOR PROSTITUTE' GROUP BY iucr_no HAVING COUNT(iucr_no) > ( SELECT SUM(CASE WHEN secondary_description = 'SOLICIT FOR PROSTITUTE' THEN 1.0 ELSE 0 END) / COUNT(iucr_no) AS average FROM IUCR ) )
6,453
challenging
chicago_crime
Please list any three criminal sexual assault cases against persons where the criminals have been arrested.
"Criminal Sexual Assault" is the title of crime; against person refers to crime_against = 'Persons'; criminals have been arrested refers to arrest = 'TRUE'; cases refers to case_number
SELECT T2.case_number FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T1.title = 'Criminal Sexual Assault' AND T2.arrest = 'TRUE' AND T1.crime_against = 'Persons' LIMIT 3
2,084
moderate
chicago_crime
In which ward of more than 55,000 inhabitants are there more crimes of intimidation with extortion?
more than 55000 inhabitants refers to Population > 55000; 'INTIMIDATION' is the primary_description; 'EXTORTION' refers to secondary_description; more crime refers to Count(ward_no)
SELECT T3.ward_no FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN Ward AS T3 ON T3.ward_no = T2.ward_no WHERE T1.primary_description = 'INTIMIDATION' AND T1.secondary_description = 'EXTORTION' AND T3.Population > 55000 GROUP BY T3.ward_no ORDER BY COUNT(T3.ward_no) DESC LIMIT 1
541
moderate
chicago_crime
How many vandalisms were arrested in the ward represented by Edward Burke?
vandalism refers to title = 'Vandalism'; arrested refers to arrest = 'TRUE'
SELECT SUM(CASE WHEN T1.alderman_last_name = 'Burke' THEN 1 ELSE 0 END) FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no INNER JOIN FBI_Code AS T3 ON T2.fbi_code_no = T3.fbi_code_no WHERE T3.title = 'Vandalism' AND T2.arrest = 'TRUE' AND T1.alderman_first_name = 'Edward'
3,170
moderate
chicago_crime
In which district have there been more intimidation-type crimes?
more intimidation-type crime refers to Max(Count(primary_description = 'INTIMIDATION')); district refers to district_name
SELECT T3.district_name FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no WHERE T1.primary_description = 'INTIMIDATION' GROUP BY T3.district_name ORDER BY COUNT(T1.primary_description) DESC LIMIT 1
5,917
moderate
chicago_crime
In the South side community, what is the name of the community with the most reported incidents of unlawful taking, carrying, leading, or riding away of property from the possession or constructive possession of another person?
"unlawful taking, carrying, leading, or riding away of property from the possession or constructive possession of another person" is the description; name of community refer to community_area_name; most reported incidents refers to Max(Count(fbi_code_no))
SELECT T3.community_area_name FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no INNER JOIN Community_Area AS T3 ON T2.community_area_no = T3.community_area_no WHERE T3.side = 'South' AND T1.description = 'The unlawful taking, carrying, leading, or riding away of property FROM the possession or constructive possession of another person.' GROUP BY T3.community_area_name ORDER BY COUNT(T1.fbi_code_no) DESC LIMIT 1
3,607
challenging
chicago_crime
What is the short description of the crime committed the most by criminals in the least populated community?
short description refers to title; committed the most refers to max(fbi_code_no); the least populated community refers to min(population)
SELECT T3.title 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 GROUP BY T3.title ORDER BY T1.population ASC, T3.fbi_code_no DESC LIMIT 1
2,841
moderate
chicago_crime
Provide case numbers, aldermen's full names, and district names of the crimes that happened in 0000X N FRANCISCO AVE.
aldermen's full name refers to alderman_name_suffix, alderman_first_name, alderman_last_name; 0000X N FRANCISCO AVE refers to block = '0000X N FRANCISCO AVE'
SELECT T2.case_number, T3.alderman_first_name, T3.alderman_last_name, T1.district_name FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no INNER JOIN Ward AS T3 ON T2.ward_no = T3.ward_no WHERE T2.block = '0000X N FRANCISCO AVE' GROUP BY T2.case_number, T3.alderman_first_name, T3.alderman_last_name, T1.district_name
1,585
moderate
chicago_crime
Among the crimes reported to the ward located at 1958 N. Milwaukee Ave., list down the report number of the crimes happened inside the apartment.
1958 N. Milwaukee Ave. refers to ward_office_address = '1958 N. Milwaukee Ave.'; report number refers to case_number; inside the apartment refers to location_description = 'APARTMENT'
SELECT T1.case_number FROM Crime AS T1 INNER JOIN Ward AS T2 ON T2.ward_no = T1.ward_no WHERE T1.location_description = 'APARTMENT' AND T2.ward_office_address = '1958 N. Milwaukee Ave.'
4,402
moderate
chicago_crime
Calculate the difference in the average number of vehicular hijackings and aggravated vehicular hijackings in the districts.
"VEHICULAR HIJACKING" and "AGGRAVATED VEHICULAR HIJACKING" are both secondary_description; difference in average = Subtract (Divide(Count(secondary_description = 'VEHICULAR HIJACKING'), Count(district_name)), Divide(Count(secondary_description = "AGGRAVATED VEHICULAR HIJACKING"), Count(district_name)))
SELECT ROUND(CAST(COUNT(CASE WHEN T1.secondary_description = 'VEHICULAR HIJACKING' THEN T1.iucr_no END) AS REAL) / CAST(COUNT(DISTINCT CASE WHEN T1.secondary_description = 'VEHICULAR HIJACKING' THEN T3.district_name END) AS REAL) - CAST(COUNT(CASE WHEN T1.secondary_description = 'AGGRAVATED VEHICULAR HIJACKING' THEN T1.iucr_no END) AS REAL) / CAST(COUNT(DISTINCT CASE WHEN T1.secondary_description = 'AGGRAVATED VEHICULAR HIJACKING' THEN T3.district_name END) AS REAL), 4) AS "difference" FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no
921
challenging
chicago_crime
Please list the location coordinates of all the incidents that had happened in the ward represented by alderman Pat Dowell.
location coordinates refers to latitude, longitude
SELECT T2.latitude, T2.longitude FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T1.alderman_first_name = 'Pat' AND T1.alderman_last_name = 'Dowell' AND T2.latitude IS NOT NULL AND T2.longitude IS NOT NULL
4,126
moderate
chicago_crime
How many simple assaults happened on 2018/9/8?
simple assault refers to primary_description = 'ASSAULT'AND secondary_description = 'SIMPLE'; on 2018/9/8 refers to date like '%9/8/2018%'
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'
3,601
moderate
chicago_crime
How many cases have been arrested among the crimes that happened in the restaurant of Englewood?
arrested refers to arrest = 'TRUE'; restaurant refers to location_description = 'RESTAURANT'; Englewood refers to district_name = 'Englewood'
SELECT SUM(CASE WHEN T1.arrest = 'TRUE' THEN 1 ELSE 0 END) FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T2.district_name = 'Englewood' AND T1.location_description = 'RESTAURANT'
1,526
moderate
chicago_crime
Among the cases reported in the ward with Edward Burke as the alderman and happened in the community area with the highest population, provide the report number of the crime with the highest beat.
the highest population refers to max(population); report number refers to report_no; the highest beat refers to max(beat)
SELECT T2.report_no FROM Ward AS T1 INNER JOIN Crime AS T2 ON T2.ward_no = T1.ward_no INNER JOIN Community_Area AS T3 ON T3.community_area_no = T2.community_area_no WHERE T1.alderman_first_name = 'Edward' AND T1.alderman_last_name = 'Burke' ORDER BY T2.beat DESC, T3.population DESC LIMIT 1
3,608
moderate
chicago_crime
How many violation of laws are there where no arrest has been made?
"The violation of laws " is the description of incidents; no arrest has been made refers to arrest = 'FALSE'
SELECT SUM(CASE WHEN T1.description LIKE '%The violation of laws%' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T2.Arrest = 'FALSE'
2,303
moderate
chicago_crime
What is the percentage of under $500 thefts among all cases that happened in West Englewood?
under $500 refers to secondary_description = '$500 AND UNDER'; theft refers to primary_description = 'THEFT'; West Englewood refers to community_area_name = 'West Englewood'; percentage = divide(count(case_number where secondary_description = '$500 AND UNDER'), count(case_number)) where primary_description = 'THEFT' and community_area_name = 'West Englewood' * 100%
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'
120
challenging
chicago_crime
What is the weekly average number of fraud incidents that were reported in January 2018? Provide the description of the location where the majority of fraud incidents occurred in the said month.
fraud incident refers to title = 'Fraud'; reported in January 2018 refers to Substr(date, 1, 1) = '1' AND Substr(date, 5, 4) = '2018'; description of location refers to location_description; weekly average refers to Divide (Count(report_no), 4); majority of incidents occurred refers to Max(Count(location_description))
SELECT CAST(COUNT(T1.fbi_code_no) AS REAL) / 4 FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018'
2,964
challenging
chicago_crime
How many different types of crimes, according to the primary description, have occurred in the Hermosa neighborhood?
"Hermosa" is the neighborhood_name
SELECT SUM(CASE WHEN T4.neighborhood_name = 'Hermosa' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN Community_Area AS T3 ON T3.community_area_no = T2.community_area_no INNER JOIN Neighborhood AS T4 ON T4.community_area_no = T3.community_area_no
1,103
challenging
chicago_crime
How many percent of domestic violence cases were arrested in West Pullman?
domestic violence refers to domestic = 'TRUE'; arrested refers to arrest = 'TRUE'; West Pullman refers to community_area_name = 'West Pullman'; percent = divide(count(report_no where arrest = 'TRUE'), count(report_no)) where domestic = 'TRUE' and community_area_name = 'West Pullman' * 100%
SELECT CAST(COUNT(CASE WHEN T2.arrest = 'TRUE' THEN T2.report_no END) AS REAL) * 100 / COUNT(T2.report_no) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.community_area_name = 'West Pullman' AND T2.domestic = 'TRUE'
1,809
moderate
chicago_crime
What is the average number of incidents per month in 2018 in the ward with the most population?
in 2018 refers to date like '%2018%'; ward with most population refers to Max(Population); average number of incident per month refers to Divide(Count(ward_no), 12)
SELECT COUNT(T1.ward_no) / 12 AS average FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.date LIKE '%2018%' AND T1.Population = ( SELECT MAX(T1.Population) FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.date LIKE '%2018%' )
5,729
moderate
chicago_crime
Please state the district name where incident number JB106545 took place.
incident number JB106545 refers to case_number = 'JB106545'
SELECT T1.case_number FROM Crime AS T1 INNER JOIN FBI_Code AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T2.title = 'Criminal Sexual Assault' AND T2.crime_against = 'Persons' AND T1.arrest = 'TRUE' LIMIT 3
3,940
moderate
chicago_crime
More crimes happened in which community area in January, 2018, Woodlawn or Lincoln Square?
in January 2018 refers to date like '%1/2018%'; Woodlawn or Lincoln Square refers to community_area_name in ('Woodlawn', 'Lincoln Square'); number of crime refers to COUNT(report_no); the higher the report_no, the more crimes happened in the community;
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
5,740
moderate
chicago_crime
What phone number does alderman Emma Mitts have to call if she wants to speak to the commander in charge of the investigation of the crimes that have occurred in her ward?
SELECT T3.phone FROM Ward AS T1 INNER JOIN Crime AS T2 ON T2.ward_no = T1.ward_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no WHERE T1.alderman_first_name = 'Emma' AND T1.alderman_last_name = 'Mitts'
3,266
moderate
chicago_crime
What is the percentage of crime cases that have been classified as "drug abuse" by the FBI and happened on the street?
"Drug Abuse" is the title of crime; happened on the street refers to location_description = 'STREET';  percentage = Divide (Count(fbi_code_no where location_description = 'STREET'), Count(fbi_code_no)) * 100
SELECT CAST(SUM(CASE WHEN T2.title = 'Drug Abuse' AND T1.location_description = 'STREET' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.fbi_code_no) FROM Crime AS T1 INNER JOIN FBI_Code AS T2 ON T1.fbi_code_no = T2.fbi_code_no
3,638
challenging
chicago_crime
List the report number of crimes against property happened in Riverdale.
crime against property refers to crime_against = 'Property'; Riverdale refers to community_area_name = 'Riverdale'
SELECT SUM(CASE WHEN T1.crime_against = 'Property' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T2.fbi_code_no = T1.fbi_code_no INNER JOIN Community_Area AS T3 ON T3.community_area_no = T2.community_area_no WHERE T3.community_area_name = 'Riverdale'
2,328
moderate
chicago_crime
What is the fax number for the district with the most number of crimes in January, 2018?
fax number refers to fax; the most number of crimes refers to max(count(case_number)); in January 2018 refers to date like '%1/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
2,572
moderate
codebase_comments
How many language code of method is used for the github address "https://github.com/managedfusion/managedfusion.git "?
language code of method refers to Lang; github address refers to Url; Url = 'https://github.com/managedfusion/managedfusion.git';
SELECT COUNT(DISTINCT T3.Lang) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId INNER JOIN Method AS T3 ON T2.Id = T3.SolutionId WHERE T1.Url = 'https://github.com/managedfusion/managedfusion.git'
3,270
moderate
codebase_comments
What is the percentage of solutions for the method that needs to be compiled in the English methods?
method that needs to be compiled refers to WasCompiled = 0; English method refers to Lang = 'en'; percentage of solutions = MULTIPLY(DIVIDE(SUM(WasCompiled = 0), COUNT(Solution.Id)), 100);
SELECT CAST(SUM(CASE WHEN T1.WasCompiled = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(Lang) FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Lang = 'en'
712
moderate
codebase_comments
Show the full Comment of the method "DE2_UE_Fahrradkurier.de2_uebung_fahrradkurierDataSet1TableAdapters.TableAdapterManager.UpdateInsertedRows".
SELECT FullComment FROM Method WHERE Name = 'DE2_UE_Fahrradkurier.de2_uebung_fahrradkurierDataSet1TableAdapters.TableAdapterManager.UpdateInsertedRows'
4,360
moderate
codebase_comments
What is the comment format of method number 50 with the solution path "managedfusion_managedfusion\ManagedFusion.sln"?
comment format refers to CommentIsXml; method number refers to Method_100k.Id; Method_100k.Id = 50; solution path refers to Path; Path = 'managedfusion_managedfusion\ManagedFusion.sln';
SELECT CASE WHEN T2.CommentIsXml = 0 THEN 'isNotXMLFormat' WHEN T2.CommentIsXml = 1 THEN 'isXMLFormat' END format FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.Id = 50 AND T1.Path = 'managedfusion_managedfusionManagedFusion.sln'
6,082
moderate
codebase_comments
In "maxild_playground\Playground.sln", what is the time of sampling for the method "GitHubRepo.Cli.GitHubClientWrapper.GetReleases"?
the time of sampling refers to SampledAt; 'maxild_playground\Playground.sln' is the path of a solution
SELECT T2.SampledAt FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'maxild_playgroundPlayground.sln' AND T2.Name = 'GitHubRepo.Cli.GitHubClientWrapper.GetReleases'
1,899
moderate
codebase_comments
What is the percentage of the methods' solutions that need to be compiled among the methods whose comments is XML format?
comment is XML format refers to CommentIsXml = 1; solution needs to be compiled refesr to WasCompiled = 0; percentage = MULTIPLY(DIVIDE(SUM(WasCompiled = 0), COUNT(Solution.Id)), 100);
SELECT CAST(SUM(CASE WHEN T1.WasCompiled = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.SolutionId) FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T2.CommentIsXml = 1
2,266
moderate
codebase_comments
How many percent more of the watchers for the repository of solution No.83855 than No.1502?
solution No. refers to Solution.Id; percentage = DIVIDE(MULTIPLY(SUBTRACT(SUM(Solution.Id = 83855), SUM(Solution.Id = 1502)), 100)), SUM(Soltution.Id = 1502);
SELECT CAST(SUM(CASE WHEN T2.Id = 83855 THEN T1.Watchers ELSE 0 END) - SUM(CASE WHEN T2.Id = 1502 THEN T1.Watchers ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T2.Id = 1502 THEN T1.Watchers ELSE 0 END) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId
5,898
challenging
codebase_comments
How many XML format does the github address "https://github.com/dogeth/vss2git.git" have?
Xml format refers to CommentisXml, github address refers to Url; Url = 'https://github.com/dogeth/vss2git.git';
SELECT COUNT(T3.CommentIsXml) FROM Repo AS T1 INNER JOIN Solution AS T2 ON T1.Id = T2.RepoId INNER JOIN Method AS T3 ON T2.Id = T3.SolutionId WHERE T1.Url = 'https://github.com/dogeth/vss2git.git' AND T3.CommentIsXml = 1
298
moderate
codebase_comments
List all the method name of the solution path "graffen_NLog.Targets.Syslog\src\NLog.Targets.Syslog.sln ".
method name refers to Name; solution path refers to Path; Path = 'graffen_NLog.Targets.Syslog\src\NLog.Targets.Syslog.sln';
SELECT DISTINCT T2.Name FROM Solution AS T1 INNER JOIN Method AS T2 ON T1.Id = T2.SolutionId WHERE T1.Path = 'graffen_NLog.Targets.SyslogsrcNLog.Targets.Syslog.sln'
3,710
moderate