input
stringlengths
201
2.7k
output
stringlengths
24
744
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Among the crimes located in the community area with the highest population, what is the percentage of domestic violence? [/INST] [/INST]
SELECT CAST(COUNT(CASE WHEN T2.domestic = 'TRUE' THEN T2.domestic END) AS REAL) * 100 / COUNT(T2.domestic) FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no GROUP BY T1.community_area_no HAVING COUNT(T1.population) ORDER BY COUNT(T1.population) DESC LIMIT 1;
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: List the case number of the crimes in wards with population below 52000 that have beat greater than the 90% of the average beat of all crimes. [/INST] [/INST]
SELECT COUNT(T1.report_no) FROM Crime AS T1 INNER JOIN Ward AS T2 ON T1.ward_no = T2.ward_no WHERE T2.Population < 52000 AND T1.beat > ( SELECT AVG(T1.beat) * 0.9 FROM Crime AS T1 INNER JOIN Ward AS T2 ON T1.ward_no = T2.ward_no WHERE T2.Population < 52000 );
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Please write me a SQL statement that answers the following question: Please list the area name of the communities in the Far north side, which has a population of more than 50000 but less than 70000. [/INST] [/INST]
SELECT community_area_name, side FROM Community_Area WHERE side = 'Far North ' AND population BETWEEN 50000 AND 70000;
[INST] Here is a database schema: Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Give the coordinate of the alleys where a crime was reported and an arrest was made. [/INST] [/INST]
SELECT latitude, longitude FROM Crime WHERE location_description = 'ALLEY' AND arrest = 'TRUE' GROUP BY latitude, longitude;
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Please write me a SQL statement that answers the following question: Find the commander's name, email address, and phone number of the Ogden district. [/INST] [/INST]
SELECT commander, email, phone FROM District WHERE district_name = 'Ogden';
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Please write me a SQL statement that answers the following question: What is the FBI code and definition of Gambling? [/INST] [/INST]
SELECT fbi_code_no, description FROM FBI_Code WHERE title = 'Gambling';
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Please write me a SQL statement that answers the following question: Among the crimes, what percentage are severe? [/INST] [/INST]
SELECT CAST(COUNT(CASE WHEN index_code = 'I' THEN iucr_no ELSE NULL END) AS REAL) * 100 / COUNT(iucr_no) FROM IUCR;
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What kind of location in Austin reported the most number of crimes? [/INST] [/INST]
SELECT T2.location_description FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no WHERE T1.district_name = 'Austin' GROUP BY T2.location_description ORDER BY COUNT(T2.case_number) DESC LIMIT 1;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: On average, how many community areas are there in a side? [/INST] [/INST]
SELECT CAST(COUNT(T1.ward_no) AS REAL) / COUNT(DISTINCT T3.side) FROM Ward AS T1 INNER JOIN Crime AS T2 ON T2.ward_no = T1.ward_no INNER JOIN Community_Area AS T3 ON T3.community_area_no = T2.community_area_no;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Which community area has the highest number of crimes reported on the street? [/INST] [/INST]
SELECT T1.community_area_no FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T2.location_description = 'STREET' GROUP BY T1.community_area_no ORDER BY COUNT(T2.location_description) DESC LIMIT 1;
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What is the average number of reckless homicides that happened in a district? [/INST] [/INST]
SELECT CAST(COUNT(T2.report_no) AS REAL) / COUNT(DISTINCT T1.district_name) FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no INNER JOIN IUCR AS T3 ON T3.iucr_no = T2.iucr_no WHERE T3.secondary_description = 'RECKLESS HOMICIDE';
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Find the ward office's address and phone number of the ward where the most crimes without arrest occurred. [/INST] [/INST]
SELECT T2.ward_office_address, T2.ward_office_phone FROM Crime AS T1 INNER JOIN Ward AS T2 ON T2.ward_no = T1.ward_no WHERE T1.arrest = 'FALSE' GROUP BY T2.ward_office_address, T2.ward_office_phone ORDER BY COUNT(T1.arrest) DESC LIMIT 1;
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Give the case number and coordinates of the places where child abduction is reported. [/INST] [/INST]
SELECT T1.case_number, T1.latitude, T1.longitude FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T2.iucr_no = T1.iucr_no WHERE T2.secondary_description = 'CHILD ABDUCTION';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What is the most reported crime in the Northwest side? [/INST] [/INST]
SELECT T3.secondary_description FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no INNER JOIN IUCR AS T3 ON T3.iucr_no = T2.iucr_no WHERE T1.side = 'Northwest ' GROUP BY T3.secondary_description ORDER BY COUNT(*) DESC LIMIT 1;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Find the community area where the least number of domestic crimes happened. [/INST] [/INST]
SELECT T2.community_area_no FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.domestic = 'TRUE' GROUP BY T2.community_area_no ORDER BY COUNT(T2.community_area_no) ASC LIMIT 1;
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: In drug abuse crimes, what percentage is related to cannabis? [/INST] [/INST]
SELECT CAST(COUNT(CASE WHEN T1.secondary_description LIKE '%CANNABIS%' THEN T1.secondary_description END) AS REAL) * 100 / COUNT(T1.secondary_description) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN FBI_Code AS T3 ON T3.fbi_code_no = T2.fbi_code_no WHERE T3.title = 'Drug Abuse';
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What is the average number of less severe crimes reported a day in February of 2018? [/INST] [/INST]
SELECT CAST(COUNT(T2.case_number) AS REAL) / 28 FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no WHERE T2.date LIKE '2/%/2018%' AND T1.index_code = 'N';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: List the name and population of the communities where more than average solicit for prostitutes were reported. [/INST] [/INST]
SELECT T2.community_area_name, T2.population FROM Crime AS T1 INNER JOIN Community_Area AS T2 ON T2.community_area_no = T1.community_area_no INNER JOIN IUCR AS T3 ON T3.iucr_no = T1.iucr_no WHERE T3.iucr_no = ( SELECT iucr_no FROM IUCR WHERE secondary_description = 'SOLICIT FOR PROSTITUTE' GROUP BY iucr_no HAVING COUNT(iucr_no) > ( SELECT SUM(CASE WHEN secondary_description = 'SOLICIT FOR PROSTITUTE' THEN 1.0 ELSE 0 END) / COUNT(iucr_no) AS average FROM IUCR ) );
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Among the incidents reported in Harrison, what percentage are disorderly conduct? [/INST] [/INST]
SELECT COUNT(CASE WHEN T3.title = 'Disorderly Conduct' THEN T2.report_no END) * 100.0 / COUNT(T2.report_no) AS per FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no INNER JOIN FBI_Code AS T3 ON T3.fbi_code_no = T2.fbi_code_no WHERE T1.district_name = 'Harrison';
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Calculate the difference in the average number of vehicular hijackings and aggravated vehicular hijackings in the districts. [/INST] [/INST]
SELECT ROUND(CAST(COUNT(CASE WHEN T1.secondary_description = 'VEHICULAR HIJACKING' THEN T1.iucr_no END) AS REAL) / CAST(COUNT(DISTINCT CASE WHEN T1.secondary_description = 'VEHICULAR HIJACKING' THEN T3.district_name END) AS REAL) - CAST(COUNT(CASE WHEN T1.secondary_description = 'AGGRAVATED VEHICULAR HIJACKING' THEN T1.iucr_no END) AS REAL) / CAST(COUNT(DISTINCT CASE WHEN T1.secondary_description = 'AGGRAVATED VEHICULAR HIJACKING' THEN T3.district_name END) AS REAL), 4) AS "difference" FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no;
[INST] Here is a database schema: Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: How many crimes happened in longitude -8772658001? [/INST] [/INST]
SELECT COUNT(*) FROM Crime WHERE longitude = '-87.72658001';
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Please write me a SQL statement that answers the following question: List all the crimes of the narcotic type that exist. [/INST] [/INST]
SELECT secondary_description FROM IUCR WHERE primary_description = 'NARCOTICS' GROUP BY secondary_description;
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Please write me a SQL statement that answers the following question: What is the first name of the aldermen of wards with more than 50,000 inhabitants? [/INST] [/INST]
SELECT alderman_first_name FROM Ward WHERE Population > 50000;
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: List crimes that the FBI has classified as Drug Abuse by their report number. [/INST] [/INST]
SELECT T2.report_no FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T2.fbi_code_no = T1.fbi_code_no WHERE T1.title = 'Drug Abuse';
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: How many weapons violation crimes have occurred in the Calumet district? [/INST] [/INST]
SELECT SUM(CASE WHEN T3.district_name = 'Calumet' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no WHERE T1.primary_description = 'WEAPONS VIOLATION';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What is the exact location of the crimes that occurred in the Belmont Cragin community? [/INST] [/INST]
SELECT T2.latitude, T2.longitude FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.community_area_name = 'Belmont Cragin' GROUP BY T2.latitude, T2.longitude;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Neighborhood : neighborhood_name [ TEXT ] primary_key community_area_no [ INTEGER ] Neighborhood.community_area_no = Community_Area.community_area_no Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: How many different types of crimes, according to the primary description, have occurred in the Hermosa neighborhood? [/INST] [/INST]
SELECT SUM(CASE WHEN T4.neighborhood_name = 'Hermosa' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN Community_Area AS T3 ON T3.community_area_no = T2.community_area_no INNER JOIN Neighborhood AS T4 ON T4.community_area_no = T3.community_area_no;
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: How many domestic crime cases has Commander Ronald A. Pontecore Jr. been responsible for investigating? [/INST] [/INST]
SELECT SUM(CASE WHEN T2.domestic = 'TRUE' THEN 1 ELSE 0 END) FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no WHERE T1.commander = 'Ronald A. Pontecore Jr.';
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: How many crimes against society happened in the Wentworth district according to the FBI? [/INST] [/INST]
SELECT SUM(CASE WHEN T1.crime_against = 'Society' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T2.fbi_code_no = T1.fbi_code_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no WHERE T3.district_name = 'Wentworth';
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What phone number does alderman Emma Mitts have to call if she wants to speak to the commander in charge of the investigation of the crimes that have occurred in her ward? [/INST] [/INST]
SELECT T3.phone FROM Ward AS T1 INNER JOIN Crime AS T2 ON T2.ward_no = T1.ward_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no WHERE T1.alderman_first_name = 'Emma' AND T1.alderman_last_name = 'Mitts';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: How many crimes described as 'The theft of a motor vehicle' by the FBI have taken place in the Lake View community? [/INST] [/INST]
SELECT SUM(CASE WHEN T3.community_area_name = 'Lake View' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T2.fbi_code_no = T1.fbi_code_no INNER JOIN Community_Area AS T3 ON T3.community_area_no = T2.community_area_no WHERE T1.description = 'The theft of a motor vehicle.';
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: In which district have there been more intimidation-type crimes? [/INST] [/INST]
SELECT T3.district_name FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no WHERE T1.primary_description = 'INTIMIDATION' GROUP BY T3.district_name ORDER BY COUNT(T1.primary_description) DESC LIMIT 1;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What types of domestic crimes have occurred the most in the North Lawndale community? [/INST] [/INST]
SELECT T2.domestic FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T2.community_area_no = T1.community_area_no WHERE T1.community_area_name = 'North Lawndale' AND T2.domestic = 'TRUE' GROUP BY T2.domestic ORDER BY COUNT(T2.domestic) DESC LIMIT 1;
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: In which ward of more than 55,000 inhabitants are there more crimes of intimidation with extortion? [/INST] [/INST]
SELECT T3.ward_no FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN Ward AS T3 ON T3.ward_no = T2.ward_no WHERE T1.primary_description = 'INTIMIDATION' AND T1.secondary_description = 'EXTORTION' AND T3.Population > 55000 GROUP BY T3.ward_no ORDER BY COUNT(T3.ward_no) DESC LIMIT 1;
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Which commander has had to deal with more cases of criminal sexual abuse? [/INST] [/INST]
SELECT T3.commander FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T2.iucr_no = T1.iucr_no INNER JOIN District AS T3 ON T3.district_no = T2.district_no WHERE T1.secondary_description = 'CRIMINAL SEXUAL ABUSE' GROUP BY T3.commander ORDER BY COUNT(T1.secondary_description) DESC LIMIT 1;
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What percentage of non-domestic crimes have occurred in the Jefferson Park district? [/INST] [/INST]
SELECT CAST(COUNT(CASE WHEN T2.domestic = 'FALSE' THEN T2.case_number END) AS REAL) * 100 / COUNT(T2.case_number) FROM District AS T1 INNER JOIN Crime AS T2 ON T2.district_no = T1.district_no WHERE T1.district_name = 'Jefferson Park';
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What is the average population of the wards where apartment crimes have been reported without arrests? [/INST] [/INST]
SELECT AVG(T2.Population) FROM Crime AS T1 INNER JOIN Ward AS T2 ON T2.ward_no = T1.ward_no WHERE T1.location_description = 'APARTMENT' AND T1.arrest = 'FALSE';
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Please write me a SQL statement that answers the following question: What are the full names of the top 5 most crowded ward aldermen? [/INST] [/INST]
SELECT alderman_first_name, alderman_last_name FROM Ward ORDER BY Population DESC LIMIT 5;
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Please write me a SQL statement that answers the following question: How many crime against property are there? [/INST] [/INST]
SELECT COUNT(*) AS cnt FROM FBI_Code WHERE crime_against = 'Property';
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Please write me a SQL statement that answers the following question: How many districts are there in the police district building with a zip code of 60608? [/INST] [/INST]
SELECT COUNT(*) AS cnt FROM District WHERE zip_code = 60608;
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Please write me a SQL statement that answers the following question: Who is the crime against criminal sexual abuse? [/INST] [/INST]
SELECT crime_against FROM FBI_Code WHERE title = 'Criminal Sexual Abuse';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Neighborhood : neighborhood_name [ TEXT ] primary_key community_area_no [ INTEGER ] Neighborhood.community_area_no = Community_Area.community_area_no Please write me a SQL statement that answers the following question: Which community has the highest number of neighborhoods? [/INST] [/INST]
SELECT T1.community_area_name FROM Community_Area AS T1 INNER JOIN Neighborhood AS T2 ON T1.community_area_no = T2.community_area_no ORDER BY T2.community_area_no DESC LIMIT 1;
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: How many severe crime incidents were reported at coordinate 41.64820151, -87.54430496? [/INST] [/INST]
SELECT SUM(CASE WHEN T1.longitude = '-87.54430496' THEN 1 ELSE 0 END) FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.report_no = T2.iucr_no WHERE T2.index_code = 'I' AND T1.latitude = '41.64820251';
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Who is the commanding officer in the district with the highest number of reported crimes where no arrest has been made? [/INST] [/INST]
SELECT T2.commander FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T1.arrest = 'FALSE' GROUP BY T2.commander ORDER BY COUNT(T1.report_no) DESC LIMIT 1;
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What are the general and specific descriptions of the most common crime incidents that happened in an aircraft? [/INST] [/INST]
SELECT T2.primary_description, T2.secondary_description FROM Crime AS T1 INNER JOIN IUCR AS T2 ON T1.iucr_no = T2.iucr_no WHERE T1.location_description = 'AIRCRAFT' GROUP BY T1.iucr_no ORDER BY COUNT(T1.iucr_no) DESC LIMIT 1;
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Between Deering and Near West districts, which district reported the most number of crime incidents that happened in a library? [/INST] [/INST]
SELECT T1.district_name FROM District AS T1 INNER JOIN Crime AS T2 ON T1.district_no = T2.district_no WHERE T1.district_name IN ('Deering', 'Near West') AND T2.location_description = 'LIBRARY' GROUP BY T1.district_name ORDER BY COUNT(T2.district_no) DESC LIMIT 1;
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: How many arrests have been made due to forcible entry burglary that took place in a day care center? [/INST] [/INST]
SELECT SUM(CASE WHEN T2.arrest = 'TRUE' THEN 1 ELSE 0 END) FROM IUCR AS T1 INNER JOIN Crime AS T2 ON T1.iucr_no = T2.iucr_no WHERE T2.location_description = 'DAY CARE CENTER' AND T1.secondary_description = 'FORCIBLE ENTRY' AND T1.primary_description = 'BURGLARY';
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What is the name of the district with the highest number of domestic violence cases? [/INST] [/INST]
SELECT T2.district_name FROM Crime AS T1 INNER JOIN District AS T2 ON T1.district_no = T2.district_no WHERE T1.domestic = 'TRUE' GROUP BY T2.district_name ORDER BY COUNT(T1.district_no) DESC LIMIT 1;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: In the least populated community, what is the most common location of all the reported crime incidents? [/INST] [/INST]
SELECT T2.location_description FROM Community_Area AS T1 INNER JOIN Crime AS T2 ON T1.community_area_no = T2.community_area_no WHERE T1.population = ( SELECT MIN(population) FROM Community_Area ) AND T2.location_description IS NOT NULL GROUP BY T2.location_description;
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: How many violation of laws are there where no arrest has been made? [/INST] [/INST]
SELECT SUM(CASE WHEN T1.description LIKE '%The violation of laws%' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no WHERE T2.Arrest = 'FALSE';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What is the precise coordinate of the location where simple assault incidents happened the most in Chatham? [/INST] [/INST]
SELECT T2.latitude, T2.longitude FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no INNER JOIN Community_Area AS T3 ON T2.community_area_no = T3.community_area_no WHERE T1.title = 'Simple Assault' AND T3.community_area_name = 'Chatham' AND T3.community_area_no = 44 ORDER BY T2.latitude DESC, T2.longitude DESC LIMIT 1;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: In the South side community, what is the name of the community with the most reported incidents of unlawful taking, carrying, leading, or riding away of property from the possession or constructive possession of another person? [/INST] [/INST]
SELECT T3.community_area_name FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no INNER JOIN Community_Area AS T3 ON T2.community_area_no = T3.community_area_no WHERE T3.side = 'South' AND T1.description = 'The unlawful taking, carrying, leading, or riding away of property FROM the possession or constructive possession of another person.' GROUP BY T3.community_area_name ORDER BY COUNT(T1.fbi_code_no) DESC LIMIT 1;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: How many crime against society were reported in Englewood? [/INST] [/INST]
SELECT SUM(CASE WHEN T3.community_area_name = 'Englewood' THEN 1 ELSE 0 END) FROM FBI_Code AS T1 INNER JOIN Crime AS T2 ON T1.fbi_code_no = T2.fbi_code_no INNER JOIN Community_Area AS T3 ON T2.community_area_no = T3.community_area_no WHERE T1.crime_against = 'Society';
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: 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. [/INST] [/INST]
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';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Please write me a SQL statement that answers the following question: Please list any three community areas with a population of more than 50,000. [/INST] [/INST]
SELECT community_area_name FROM Community_Area WHERE population > 50000 LIMIT 3;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Please write me a SQL statement that answers the following question: What are the communities that are grouped together on the central side? [/INST] [/INST]
SELECT community_area_name FROM Community_Area WHERE side = 'Central';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Please write me a SQL statement that answers the following question: 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? [/INST] [/INST]
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;
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Please write me a SQL statement that answers the following question: Please list all of the contact information for the police district Near West. [/INST] [/INST]
SELECT phone, fax, tty, twitter FROM District WHERE district_name = 'Near West';
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Please write me a SQL statement that answers the following question: Who is responsible for crime cases in district Lincoln? [/INST] [/INST]
SELECT commander FROM District WHERE district_name = 'Lincoln';
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Please write me a SQL statement that answers the following question: What is the general and specific description of incident 275? [/INST] [/INST]
SELECT primary_description, secondary_description FROM IUCR WHERE iucr_no = 275;
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Please write me a SQL statement that answers the following question: What is the percentage of severe cases that are related to sexual assault? [/INST] [/INST]
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';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Neighborhood : neighborhood_name [ TEXT ] primary_key community_area_no [ INTEGER ] Neighborhood.community_area_no = Community_Area.community_area_no Please write me a SQL statement that answers the following question: What are the neighborhoods that are located in the North Center community area? [/INST] [/INST]
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';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Neighborhood : neighborhood_name [ TEXT ] primary_key community_area_no [ INTEGER ] Neighborhood.community_area_no = Community_Area.community_area_no Please write me a SQL statement that answers the following question: How many neighborhoods can be found in the Forest Glen community area? [/INST] [/INST]
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;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Neighborhood : neighborhood_name [ TEXT ] primary_key community_area_no [ INTEGER ] Neighborhood.community_area_no = Community_Area.community_area_no Please write me a SQL statement that answers the following question: What is the total population of the neighborhoods Avondale Gardens, Irving Park, Kilbourn Park, Merchant Park, Old Irving Park, and The Villa? [/INST] [/INST]
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';
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: How many crime cases have been classified as "Weapons Violation" by the FBI? [/INST] [/INST]
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;
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Please list any three criminal sexual assault cases against persons where the criminals have been arrested. [/INST] [/INST]
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;
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Please state the district name where incident number JB106545 took place. [/INST] [/INST]
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;
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What is the general description for case number JB106010? [/INST] [/INST]
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';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Please name three communities that experience the fraud incident. [/INST] [/INST]
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;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What was the major type of crime that happened in the Rogers Park community area? [/INST] [/INST]
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;
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: At which district did the multiple homicide case number JB120039 occurred? [/INST] [/INST]
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;
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What is the percentage of crime cases that have been classified as "drug abuse" by the FBI and happened on the street? [/INST] [/INST]
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;
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Please write me a SQL statement that answers the following question: Provide the ward number with the highest population. [/INST] [/INST]
SELECT ward_no FROM Ward ORDER BY Population DESC LIMIT 1;
[INST] Here is a database schema: Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What is the beat and location description of the case JB112212? [/INST] [/INST]
SELECT beat, location_description FROM Crime WHERE case_number = 'JB112212';
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Please write me a SQL statement that answers the following question: Give the FBI code for the crime described by "The killing of one human being by another." [/INST] [/INST]
SELECT fbi_code_no FROM FBI_Code WHERE description = 'The killing of one human being by another.';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Provide at least 5 ward office addresses associated with the crimes that happened in the community of Montclare. [/INST] [/INST]
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;
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: List down the district's commander associated with the crime that happened at the yard and has a beat of 532. [/INST] [/INST]
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;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Neighborhood : neighborhood_name [ TEXT ] primary_key community_area_no [ INTEGER ] Neighborhood.community_area_no = Community_Area.community_area_no Please write me a SQL statement that answers the following question: What is the neighborhood name in the community area of Lake View? [/INST] [/INST]
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';
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Neighborhood : neighborhood_name [ TEXT ] primary_key community_area_no [ INTEGER ] Neighborhood.community_area_no = Community_Area.community_area_no Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Name the neighborhood of the community area in crime with report number 23843? [/INST] [/INST]
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;
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What is the FBI description of the crime for report number 23778? [/INST] [/INST]
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;
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: List down the report number of crimes associated with the district commander named Jill M. Stevens. [/INST] [/INST]
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;
[INST] Here is a database schema: Community_Area : community_area_no [ INTEGER ] primary_key community_area_name [ TEXT ] side [ TEXT ] population [ TEXT ] Neighborhood : neighborhood_name [ TEXT ] primary_key community_area_no [ INTEGER ] Neighborhood.community_area_no = Community_Area.community_area_no Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Among the crimes happened in the neighborhood called "Avalon Park", what is the percentage of crimes that happened inside the house? [/INST] [/INST]
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';
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Please write me a SQL statement that answers the following question: What is the full name of the alderman of ward no.21? [/INST] [/INST]
SELECT alderman_first_name, alderman_last_name, alderman_name_suffix FROM Ward WHERE ward_no = 21;
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Please write me a SQL statement that answers the following question: What is the ward ID of the most crowded ward? [/INST] [/INST]
SELECT ward_no FROM Ward ORDER BY Population DESC LIMIT 1;
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Please write me a SQL statement that answers the following question: How many incidents have the general description of "ASSAULT" in the IUCR classification? [/INST] [/INST]
SELECT COUNT(*) FROM IUCR WHERE primary_description = 'ASSAULT';
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Please write me a SQL statement that answers the following question: How many incidents are considered "severe" in the IUCR classification? [/INST] [/INST]
SELECT COUNT(*) FROM IUCR WHERE index_code = 'I';
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Among the crimes with no arrest made, how many of them happened in the ward represented by alderman Pat Dowell? [/INST] [/INST]
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';
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Which alderman represents the ward with the most number of crimes in January, 2018? Please give his or her full name. [/INST] [/INST]
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;
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Among the crimes in the ward with the most population, how many of them are cases of domestic violence? [/INST] [/INST]
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 );
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Please list the location coordinates of all the incidents that had happened in the ward represented by alderman Pat Dowell. [/INST] [/INST]
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;
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: The ward represented by which alderman had more incidents in January, 2018, Pat Dowell or Sophia King? [/INST] [/INST]
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;
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Please list the case numbers of all the incidents with the generic description of "BATTERY" in the IUCR classification. [/INST] [/INST]
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';
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Among the incidents with the generic description of "BATTERY" in the IUCR classification, how many of them do not have arrests made? [/INST] [/INST]
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';
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: 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. [/INST] [/INST]
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';
[INST] Here is a database schema: FBI_Code : fbi_code_no [ TEXT ] primary_key title [ TEXT ] description [ TEXT ] crime_against [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Among the incidents in January, 2018, how many of them were stated "against Property" in the FBI classification? [/INST] [/INST]
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';
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: District commander Robert A. Rubio was responsible for how many incidents in January, 2018? [/INST] [/INST]
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';
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Which district commander was responsible for more incidents in January, 2018, Robert A. Rubio or Glenn White? [/INST] [/INST]
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;
[INST] Here is a database schema: District : district_no [ INTEGER ] primary_key district_name [ TEXT ] address [ TEXT ] zip_code [ INTEGER ] commander [ TEXT ] email [ TEXT ] phone [ TEXT ] fax [ TEXT ] tty [ TEXT ] twitter [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Please list the blocks where all the incidents in the district commanded by Robert A. Rubio took place. [/INST] [/INST]
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';
[INST] Here is a database schema: Ward : ward_no [ INTEGER ] primary_key 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 ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: What is the average number of incidents per month in 2018 in the ward with the most population? [/INST] [/INST]
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%' );
[INST] Here is a database schema: IUCR : iucr_no [ TEXT ] primary_key primary_description [ TEXT ] secondary_description [ TEXT ] index_code [ TEXT ] Crime : report_no [ INTEGER ] primary_key case_number [ TEXT ] date [ TEXT ] block [ TEXT ] iucr_no [ TEXT ] Crime.iucr_no = IUCR.iucr_no location_description [ TEXT ] arrest [ TEXT ] domestic [ TEXT ] beat [ INTEGER ] district_no [ INTEGER ] Crime.district_no = District.district_no ward_no [ INTEGER ] Crime.ward_no = Ward.ward_no community_area_no [ INTEGER ] Crime.community_area_no = Community_Area.community_area_no fbi_code_no [ TEXT ] Crime.fbi_code_no = FBI_Code.fbi_code_no latitude [ TEXT ] longitude [ TEXT ] Please write me a SQL statement that answers the following question: Among all the incidents with no arrest made, what is the percentage of them having a generic description of "BATTERY" in the IUCR classification? [/INST] [/INST]
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';