context
stringlengths 11
9.12k
| question
stringlengths 0
1.06k
| SQL
stringlengths 2
4.44k
| source
stringclasses 28
values |
---|---|---|---|
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 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. | 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' | 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 any three community areas with a population of more than 50,000. | SELECT community_area_name FROM Community_Area WHERE population > 50000 LIMIT 3 | 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 are the communities that are grouped together on the central side? | SELECT community_area_name 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) | What is the difference between the number of communities that are located on the north and south sides with a population of more than 30,000? | SELECT SUM(CASE WHEN side = 'South ' THEN 1 ELSE 0 END) - SUM(CASE WHEN side = 'North' THEN 1 ELSE 0 END) AS DIFF FROM Community_Area WHERE population > 300000 | 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 all of the contact information for the police district Near West. | SELECT phone, fax, tty, twitter FROM District WHERE district_name = 'Near West' | 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 responsible for crime cases in district Lincoln? | SELECT commander FROM District WHERE district_name = 'Lincoln' | 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 general and specific description of incident 275? | SELECT primary_description, secondary_description FROM IUCR WHERE iucr_no = 275 | 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 severe cases that are related to sexual assault? | SELECT CAST(SUM(CASE WHEN primary_description = 'CRIM SEXUAL ASSAULT' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM IUCR WHERE index_code = 'I' | 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 are the neighborhoods that are located in the North Center community area? | 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.community_area_name = 'North Center' | 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 can be found in the Forest Glen community area? | SELECT SUM(CASE WHEN T2.community_area_name = 'Forest Glen' THEN 1 ELSE 0 END) FROM Neighborhood AS T1 INNER JOIN Community_Area 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) | What is the total population of the neighborhoods Avondale Gardens, Irving Park, Kilbourn Park, Merchant Park, Old Irving Park, and The Villa? | 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' | 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 crime cases have been classified as "Weapons Violation" by the FBI? | SELECT SUM(CASE WHEN T2.title = 'Weapons Violation' THEN 1 ELSE 0 END) FROM Crime AS T1 INNER JOIN FBI_Code AS T2 ON T1.fbi_code_no = T2.fbi_code_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) | Please list any three criminal sexual assault cases against persons where the criminals have been arrested. | 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 | 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 state the district name where incident number JB106545 took place. | 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 | 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 general description for case number JB106010? | SELECT T1.primary_description FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T2.case_number = 'JB106010' | 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 name three communities that experience the fraud incident. | 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 T1.title = 'Criminal Sexual Assault' LIMIT 3 | 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 was the major type of crime that happened in the Rogers Park community area? | SELECT T1.fbi_code_no, T1.title 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.community_area_name = 'Rogers Park' GROUP BY T1.fbi_code_no, T1.title | 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) | At which district did the multiple homicide case number JB120039 occurred? | SELECT T1.district_no, T1.district_name FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T2.case_number = 'JB120039' GROUP BY T1.district_no, T1.district_name | 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 crime cases that have been classified as "drug abuse" by the FBI and happened on the street? | 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 | 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) | Provide the ward number with the highest population. | SELECT ward_no FROM Ward 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) | What is the beat and location description of the case JB112212? | SELECT beat, location_description FROM Crime WHERE case_number = 'JB112212' | 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 for the crime described by "The killing of one human being by another." | SELECT fbi_code_no FROM FBI_Code WHERE description = 'The killing of one human being by another.' | 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) | Provide at least 5 ward office addresses associated with the crimes that happened in the community of Montclare. | SELECT T3.ward_office_address FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no INNER JOIN Ward AS T3 ON T2.ward_no = T3.ward_no WHERE T1.community_area_name = 'Montclare' GROUP BY T3.ward_office_address LIMIT 5 | 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) | List down the district's commander associated with the crime that happened at the yard and has a beat of 532. | SELECT T2.address, T2.commander FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T1.location_description = 'YARD' AND T1.beat = 532 | 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 neighborhood name in the community area of Lake View? | 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.community_area_name = 'Lake View' | 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) | Name the neighborhood of the community area in crime with report number 23843? | SELECT T3.neighborhood_name 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 T2.report_no = 23778 | 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 FBI description of the crime for report number 23778? | SELECT T1.description FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T2.report_no = 23843 | 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) | List down the report number of crimes associated with the district commander named Jill M. Stevens. | SELECT SUM(CASE WHEN T1.commander = 'Jill M. Stevens' THEN 1 ELSE 0 END) FROM District AS T1 INNER JOIN Crime 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) | Among the crimes happened in the neighborhood called "Avalon Park", what is the percentage of crimes that happened inside the house? | 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' | 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 full name of the alderman of ward no.21? | SELECT alderman_first_name, alderman_last_name, alderman_name_suffix FROM Ward WHERE ward_no = 21 | 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 ward ID of the most crowded ward? | SELECT ward_no FROM Ward 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 have the general description of "ASSAULT" in the IUCR classification? | SELECT COUNT(*) FROM IUCR WHERE 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) | How many incidents are considered "severe" in the IUCR classification? | SELECT COUNT(*) FROM IUCR WHERE index_code = 'I' | 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 with no arrest made, how many of them happened in the ward represented by alderman Pat Dowell? | SELECT SUM(CASE WHEN T1.alderman_last_name = 'Dowell' THEN 1 ELSE 0 END) FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE T2.arrest = 'FALSE' AND T1.alderman_first_name = 'Pat' | 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 alderman represents the ward with the most number of crimes in January, 2018? Please give his or her full name. | SELECT T1.ward_no, T1.alderman_first_name, T1.alderman_last_name, T1.alderman_name_suffix FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018' GROUP BY T1.ward_no ORDER BY COUNT(T1.ward_no) 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 the ward with the most population, how many of them are cases of domestic violence? | 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 ) | 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 location coordinates of all the incidents that had happened in the ward represented by alderman Pat Dowell. | 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 | 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) | The ward represented by which alderman had more incidents in January, 2018, Pat Dowell or Sophia King? | SELECT T1.alderman_first_name, T1.alderman_last_name, COUNT(T1.ward_no) AS num FROM Ward AS T1 INNER JOIN Crime AS T2 ON T1.ward_no = T2.ward_no WHERE (SUBSTR(T2.date, 1, 1) = '1' AND SUBSTR(T2.date, 5, 4) = '2018' AND T1.alderman_first_name = 'Pat' AND T1.alderman_last_name = 'Dowell') OR (T1.alderman_first_name = 'Sophia' AND T1.alderman_last_name = 'King') GROUP BY T1.ward_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) | Please list the case numbers of all the incidents with the generic description of "BATTERY" in the IUCR classification. | SELECT T2.case_number FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.primary_description = 'BATTERY' | 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 incidents with the generic description of "BATTERY" in the IUCR classification, how many of them do not have arrests made? | 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' | 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 whose short description of the kind of crime is "Homicide 1st & 2nd Degree" in the FBI classification. | 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 = 'Homicide 1st & 2nd Degree' | 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 incidents in January, 2018, how many of them were stated "against Property" in the FBI classification? | SELECT SUM(CASE WHEN SUBSTR(T2.date, 5, 4) = '2018' 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 T1.crime_against = 'Property' AND SUBSTR(T2.date, 1, 1) = '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) | District commander Robert A. Rubio was responsible for how many incidents in January, 2018? | SELECT SUM(CASE WHEN SUBSTR(T2.date, 5, 4) = '2018' THEN 1 ELSE 0 END) FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T1.commander = 'Robert A. Rubio' AND SUBSTR(T2.date, 1, 1) = '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 district commander was responsible for more incidents in January, 2018, Robert A. Rubio or Glenn White? | 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 | 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 blocks where all the incidents in the district commanded by Robert A. Rubio took place. | SELECT T2.block FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T1.commander = 'Robert A. Rubio' | 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 incidents per month in 2018 in the ward with the most population? | 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%' ) | 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 incidents with no arrest made, what is the percentage of them having a generic description of "BATTERY" in the IUCR classification? | 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' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many restaurants' owners are in California? | SELECT COUNT(owner_state) FROM businesses WHERE owner_state = 'CA' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many restaurants have met all requirements in the inspection? | SELECT COUNT(score) FROM inspections WHERE score = 100 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Among the inspections carried out in 2016, how many of them are routine? | SELECT COUNT(`date`) FROM inspections WHERE STRFTIME('%Y', `date`) = '2016' AND type = 'Routine - Unscheduled' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Please list the names of all the restaurants that have met all requirements in one inspection. | SELECT DISTINCT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.score = 100 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Among the restaurants being inspected in 2016, how many of them are in San Francisco? | SELECT COUNT(DISTINCT T2.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2016' AND T2.city IN ('San Francisco', 'SAN FRANCISCO', 'SF', 'S.F.') | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | What was the type of inspection Tiramisu Kitchen had on 2014/1/14? | SELECT T1.type FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = '2014-01-14' AND T2.name = 'Tiramisu Kitchen' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many low risk violations were found in the inspection on 2014/1/14 for Tiramisu Kitchen? | SELECT COUNT(T1.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = '2014-01-14' AND T2.name = 'Tiramisu Kitchen' AND T1.risk_category = 'Low Risk' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Please list the names of the restaurants that had a low risk violation in inspections in 2014. | SELECT DISTINCT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2014' AND T1.risk_category = 'Low Risk' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | What is the description of the low risk violation of Tiramisu Kitchen on 2014/1/14? | SELECT T1.description FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = '2014-01-14' AND T2.name = 'Tiramisu Kitchen' AND T1.risk_category = 'Low Risk' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Please list the descriptions of all the high risk violations of Tiramisu Kitchen. | SELECT DISTINCT T1.description FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'High Risk' AND T2.name = 'Tiramisu Kitchen' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many routine inspections did Tiramisu Kitchen have? | SELECT COUNT(T1.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.type = 'Routine - Unscheduled' AND T2.name = 'Tiramisu Kitchen' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Among the routine inspections of Tiramisu Kitchen, how many of them have a score of over 70? | SELECT COUNT(T2.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Tiramisu Kitchen' AND T1.type = 'Routine - Unscheduled' AND T1.score > 70 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Which restaurant had more low risk violation in inspections, Tiramisu Kitchen or OMNI S.F. Hotel - 2nd Floor Pantry? | SELECT CASE WHEN SUM(CASE WHEN T2.name = 'OMNI S.F. Hotel - 2nd Floor Pantry' THEN 1 ELSE 0 END) > SUM(CASE WHEN T2.name = 'Tiramisu Kitchen' THEN 1 ELSE 0 END) THEN 'OMNI S.F. Hotel - 2nd Floor Pantry' ELSE 'Tiramisu Kitchen' END AS result FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'Low Risk' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many high risk violations do the restaurants in San Francisco have in total? | SELECT COUNT(T2.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.city IN ('San Francisco', 'SF', 'S.F.', 'SAN FRANCISCO') AND T1.risk_category = 'High Risk' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Which restaurant has the highest total number of high risk violations? | SELECT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'High Risk' GROUP BY T2.name ORDER BY COUNT(T2.name) DESC LIMIT 1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | What is the average scores of Tiramisu Kitchen in all inspections? | SELECT AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Tiramisu Kitchen' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Which business had the most number of inspections? Give the Id number for that business. | SELECT business_id FROM inspections GROUP BY business_id ORDER BY COUNT(business_id) DESC LIMIT 1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Tell the Id number of the business with the most number of violations. | SELECT business_id FROM violations GROUP BY business_id ORDER BY COUNT(business_id) DESC LIMIT 1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Give the name of the business which met all the required standards during the unscheduled routine inspection on 2016/9/28. | SELECT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.score = 100 AND T1.`date` = '2016-09-28' AND T1.type = 'Routine - Unscheduled' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Which business had the most number of high risk violations? Give the name of the business. | SELECT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'High Risk' GROUP BY T2.name ORDER BY COUNT(T2.name) DESC LIMIT 1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many kinds of violations did "Stacks Restaurant" have on 2016/10/4? | SELECT COUNT(DISTINCT T1.violation_type_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Stacks Restaurant' AND T1.`date` = '2016-10-04' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Give the description of the moderate risk violation which "Chez Fayala, Inc." had on 2016/7/1. | SELECT T1.description FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Chez Fayala, Inc.' AND T1.`date` = '2016-07-01' AND T1.risk_category = 'Moderate Risk' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Which business had the lowest score for the unscheduled routine inspection on 2016/9/26? Give the name of the business. | SELECT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE score = ( SELECT MIN(score) FROM inspections WHERE `date` = '2016-09-26' AND type = 'Routine - Unscheduled' ) AND T1.`date` = '2016-09-26' AND T1.type = 'Routine - Unscheduled' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Provide the name of the business which had the most number of inspections because of complaint. | SELECT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.type = 'Complaint' GROUP BY T2.name ORDER BY COUNT(T1.business_id) DESC LIMIT 1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many unscheduled routine inspections did "Soma Restaurant And Bar" have? | SELECT COUNT(T1.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Soma Restaurant And Bar' AND T1.type = 'Routine - Unscheduled' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Give the address of the business with the most number of the low risk violations. | SELECT T2.address FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'Low Risk' GROUP BY T2.address ORDER BY COUNT(T1.business_id) DESC LIMIT 1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Which business was the first one to get a low risk violation because of "Permit license or inspection report not posted"? Give the name of the business. | SELECT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = ( SELECT MIN(`date`) FROM violations WHERE risk_category = 'Low Risk' AND description = 'Permit license or inspection report not posted' ) AND T1.risk_category = 'Low Risk' AND T1.description = 'Permit license or inspection report not posted' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | For the business which got the most number of violations, how many inspections did it have? | SELECT COUNT(T2.business_id) FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id GROUP BY T1.business_id ORDER BY COUNT(T1.business_id) DESC LIMIT 1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | For the business whose business certificate number is 304977, how many violations did it have on 2013/10/7? | SELECT COUNT(T1.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.business_certificate = '304977' AND T1.`date` = '2013-10-07' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | What is the average score for "Chairman Bao" in all its unscheduled routine inspections? | SELECT CAST(SUM(CASE WHEN T2.name = 'Chairman Bao' THEN T1.score ELSE 0 END) AS REAL) / COUNT(CASE WHEN T1.type = 'Routine - Unscheduled' THEN T1.score ELSE 0 END) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | What percentage of the violations for "Melody Lounge" are moderate risks? | SELECT CAST(SUM(CASE WHEN T2.risk_category = 'Moderate Risk' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.business_id) FROM businesses AS T1 INNER JOIN violations AS T2 ON T1.business_id = T2.business_id WHERE T1.name = 'Melody Lounge' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many eateries are located in Hayward? | SELECT COUNT(business_id) FROM businesses WHERE city = 'HAYWARD' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many establishments have an inspection score of no more than 50? | SELECT COUNT(DISTINCT business_id) FROM inspections WHERE score < 50 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many eateries applied in 2012? | SELECT COUNT(business_id) FROM businesses WHERE STRFTIME('%Y', application_date) = '2012' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many foodborne illness investigations were done in 2014? | SELECT COUNT(business_id) FROM inspections WHERE STRFTIME('%Y', `date`) = '2014' AND type = 'Foodborne Illness Investigation' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many owners have 5 or more establishments? | SELECT COUNT(T1.owner_name) FROM ( SELECT owner_name FROM businesses GROUP BY owner_name HAVING COUNT(owner_name) > 5 ) T1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | What are the names of the establishments that met all of the required standards in 2013? | SELECT DISTINCT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2013' AND T1.score = 100 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | In 2016, which city has the highest number of establishments with the highest health and safety hazards? | SELECT T2.city FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2016' AND T1.risk_category = 'High Risk' GROUP BY T2.city ORDER BY COUNT(T2.city) DESC LIMIT 1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | What is the name of the establishment with the lowest inspection score of all time? | SELECT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.score = ( SELECT MIN(score) FROM inspections ) | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many high risks violations did the Tiramisu Kitchen violate? | SELECT COUNT(T1.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Tiramisu Kitchen' AND T1.risk_category = 'High Risk' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many establishments with the tax code H24 have complaint inspections of 5 or more? | SELECT COUNT(*) FROM ( SELECT T1.business_id FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.tax_code = 'H24' AND T1.type = 'Complaint' GROUP BY T1.business_id HAVING COUNT(T1.business_id) > 5 ) T3 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | In 2013, what are the names of the establishments with contaminated or adulterated food? | SELECT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2013' AND T1.description = 'Contaminated or adulterated food' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Among the establishments with a postal code of 94102, how many establishments have a score of 90 or more in 2015? | SELECT COUNT(DISTINCT T2.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id INNER JOIN inspections AS T3 ON T2.business_id = T3.business_id WHERE STRFTIME('%Y', T1.`date`) = '2015' AND T2.postal_code = '94102' AND T3.score > 90 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | What are the names of the establishments that met all the required standards for 4 consecutive years? | SELECT DISTINCT T4.name FROM ( SELECT T3.name, T3.years, row_number() OVER (PARTITION BY T3.name ORDER BY T3.years) AS rowNumber FROM ( SELECT DISTINCT name, STRFTIME('%Y', `date`) AS years FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.score = 100 ) AS T3 ) AS T4 GROUP BY T4.name, date(T4.years || '-01-01', '-' || (T4.rowNumber - 1) || ' years') HAVING COUNT(T4.years) = 4 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Between 2014 to 2016, what is the average inpsection score of the establishment owned by Yiu Tim Chan in 808 Pacific Ave, San Francisco? | SELECT AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) BETWEEN '2014' AND '2016' AND T2.owner_name = 'Yiu Tim Chan' AND T2.address = '808 Pacific Ave' AND T2.city = 'San Francisco' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | What is the average score of the establishments owned by the owner with the highest number of establishments? | SELECT AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id GROUP BY T2.owner_name ORDER BY COUNT(T2.business_id) DESC LIMIT 1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | What is the name of the establishment with the highest number of low risk violations in 2014? | SELECT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2014' AND T1.risk_category = 'Low Risk' GROUP BY T2.name ORDER BY COUNT(T2.business_id) DESC LIMIT 1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Among the top 5 owners with highest number of establishments, which owner has the highest number of high risk violations? Give the name of the owner. | SELECT T4.owner_name FROM violations AS T3 INNER JOIN businesses AS T4 ON T3.business_id = T4.business_id INNER JOIN ( SELECT T2.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id GROUP BY T2.owner_name ORDER BY COUNT(T1.business_id) DESC LIMIT 5 ) AS T5 ON T4.owner_name = T5.owner_name WHERE T3.risk_category = 'High Risk' GROUP BY T4.owner_name ORDER BY COUNT(T3.risk_category) DESC LIMIT 1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Which establishment has the highest number of inspections done? Give the name of the establishment and calculate for its average score per inspection. | SELECT T2.name, AVG(T1.score) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id GROUP BY T2.name ORDER BY COUNT(T2.business_id) DESC LIMIT 1 | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many eateries got highest inspection in 2013? | SELECT COUNT(DISTINCT business_id) FROM inspections WHERE STRFTIME('%Y', `date`) = '2013' AND score = ( SELECT MAX(score) FROM inspections WHERE STRFTIME('%Y', `date`) = '2013' ) | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | List down the eateries' IDs with structural inspection type in February 2016. | SELECT business_id FROM inspections WHERE type = 'Structural Inspection' AND `date` LIKE '2016-02%' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | How many eateries had low risk for violation with unpermitted food facility description? | SELECT COUNT(DISTINCT business_id) FROM violations WHERE risk_category = 'Low Risk' AND description = 'Unpermitted food facility' | bird |
CREATE TABLE food_inspection (business_id integer, name text, address text, city text, postal_code text, latitude real, longitude real, phone_number integer, tax_code text, business_certificate integer, application_date date, owner_name text, owner_address text, owner_city text, owner_state text, owner_zip text, business_id integer, score integer, date date, type text, business_id integer, date date, violation_type_id text, risk_category text, description text) | Provide eateries' IDs, risk categories and descriptions with violation ID of 103101. | SELECT business_id, risk_category, description FROM violations WHERE violation_type_id = '103101' | bird |
Subsets and Splits