Chinastark/bird_dataset huggingface dataset:
Database: chicago_crime
Note: criminal sexual assault refers to title = 'Criminal Sexual Assault'; Adnardo Gutierrez refers to commander = 'Adnardo Gutierrez'; in the residence refers to location_description = 'REsideNCE';
Question: Among the criminal sexual assaults in the district of Adnardo Gutierrez, how many cases happened in the residence?
SQL: SELECT count(crime.report_no) FROM district INNER JOIN crime ON crime.district_no = district.district_no INNER JOIN fbi_code ON fbi_code.fbi_code_no = crime.fbi_code_no WHERE fbi_code.title = 'Criminal Sexual Assault' AND district.commander = 'Adnardo Gutierrez' AND crime.location_description = 'RESIDENCE'
Database: chicago_crime
Note: domestic violence refers to domestic = 'TRUE'; arrested refers to arrest = 'TRUE'; West Pullman refers to community_area_name = 'West Pullman'; percent = divide(count(report_no where arrest = 'TRUE'), count(report_no)) where domestic = 'TRUE' and community_area_name = 'West Pullman' * 100%;
Question: How many percent of domestic violence cases were arrested in West Pullman?
SQL: SELECT cast(count(CASE WHEN crime.arrest = 'TRUE' THEN crime.report_no END) AS REAL) * 100 / count(crime.report_no) FROM community_area INNER JOIN crime ON crime.community_area_no = community_area.community_area_no WHERE community_area.community_area_name = 'West Pullman' AND crime.domestic = 'TRUE'
Database: chicago_crime
Note: domestic violence refers to domestic = 'TRUE'; report number refers to report_no; in the bank refers to location_description = 'BANK'; percentage = divide(count(report_no where domestic = 'TRUE'), count(report_no)) * 100%;
Question: Calculate the percentage of the domestic violence cases handled by Christopher Taliaferro. Among them, list report numbers of cases that happened in the bank.
SQL: SELECT cast(count(CASE WHEN crime.domestic = 'TRUE' THEN crime.report_no END) AS REAL) * 100 / count(crime.report_no), count(CASE WHEN crime.domestic = 'TRUE' AND crime.location_description = 'BANK' THEN crime.report_no END) AS "number" FROM crime INNER JOIN ward ON ward.ward_no = crime.ward_no WHERE ward.alderman_first_name = 'Christopher' AND ward.alderman_last_name = 'Taliaferro'
Database: chicago_crime
Question: How many aldermen have "James" as their first name?
SQL: SELECT count(*) FROM ward WHERE alderman_first_name = 'James'
Database: chicago_crime
Note: on January 1 2018 refers to date LIKE '1/1/2018%';
Question: How many crimes are commited on January 1, 2018?
SQL: SELECT count(*) FROM crime WHERE date LIKE '1/1/2018%'
Database: chicago_crime
Note: the West side refers to side = 'West'; average population = avg(population) where side = 'West';
Question: Calculate the average population of community areas in the West side.
SQL: SELECT avg(population) FROM community_area WHERE side = 'West '
Database: chicago_crime
Note: the highest population refers to max(population); report number refers to report_no; the highest beat refers to max(beat);
Question: Among the cases reported in the ward with Edward Burke as the alderman and happened in the community area with the highest population, provide the report number of the crime with the highest beat.
SQL: SELECT crime.report_no FROM ward INNER JOIN crime ON crime.ward_no = ward.ward_no INNER JOIN community_area ON community_area.community_area_no = crime.community_area_no WHERE ward.alderman_first_name = 'Edward' AND ward.alderman_last_name = 'Burke' ORDER BY crime.beat DESC, community_area.population DESC LIMIT 1
Database: chicago_crime
Note: in the street refers to location_description = 'STREET';
Question: How many of the crimes that happened in the street have FBI title "Homicide 1st & 2nd Degree"?
SQL: SELECT sum(CASE WHEN crime.location_description = 'STREET' THEN 1 ELSE 0 END) FROM fbi_code INNER JOIN crime ON crime.fbi_code_no = fbi_code.fbi_code_no WHERE fbi_code.title = 'Homicide 1st & 2nd Degree'
Database: chicago_crime
Note: alderman refers to alderman_suffix, alderman_first_name, alderman_last_name; report number 23769 refers to report_no = 23769;
Question: Who is the alderman in the ward associated with the crime with report number 23769?
SQL: SELECT ward.alderman_first_name, ward.alderman_last_name FROM crime INNER JOIN ward ON ward.ward_no = crime.ward_no WHERE crime.report_no = 23769
Database: chicago_crime
Note: domestic violence refers to domestic = 'TRUE'; Lincoln Square refers to community_area_name = 'Lincoln Square';
Question: List the case numbers of domestic violence crimes reported in Lincoln Square.
SQL: SELECT crime.case_number FROM community_area INNER JOIN crime ON crime.community_area_no = community_area.community_area_no WHERE community_area.community_area_name = 'Lincoln Square' AND crime.domestic = 'TRUE'
Database: chicago_crime
Note: 1958 N. Milwaukee Ave. refers to ward_office_address = '1958 N. Milwaukee Ave.'; report number refers to case_number; inside the apartment refers to location_description = 'APARTMENT';
Question: Among the crimes reported to the ward located at 1958 N. Milwaukee Ave., list down the report number of the crimes happened inside the apartment.
SQL: SELECT crime.case_number FROM crime INNER JOIN ward ON ward.ward_no = crime.ward_no WHERE crime.location_description = 'APARTMENT' AND ward.ward_office_address = '1958 N. Milwaukee Ave.'
Database: chicago_crime
Note: Bridgeport refers to community_area_name = 'Bridgeport'; with beat less than 1000 refers to beat < 1000; total number = count(beat) where community_area_name = 'Bridgeport' and beat < 1000;
Question: What is the total number of crimes that happened in Bridgeport with beat less than 1000?
SQL: SELECT sum(CASE WHEN crime.beat < 1000 THEN 1 ELSE 0 END) FROM community_area INNER JOIN crime ON crime.community_area_no = community_area.community_area_no WHERE community_area.community_area_name = 'Bridgeport'
Database: chicago_crime
Note: report number refers to report_no; the far north side refers to side = 'Far North'; population greater than 60,000 refers to population > '60000';
Question: List the report number of crimes reported in a community area in the far north side with a population greater than 60,000.
SQL: SELECT sum(CASE WHEN community_area.population > 60000 THEN 1 ELSE 0 END) FROM community_area INNER JOIN crime ON crime.community_area_no = community_area.community_area_no WHERE community_area.side = 'Far North '
Database: chicago_crime
Note: crime against property refers to crime_against = 'Property'; Riverdale refers to community_area_name = 'Riverdale';
Question: List the report number of crimes against property happened in Riverdale.
SQL: SELECT sum(CASE WHEN fbi_code.crime_against = 'Property' THEN 1 ELSE 0 END) FROM fbi_code INNER JOIN crime ON crime.fbi_code_no = fbi_code.fbi_code_no INNER JOIN community_area ON community_area.community_area_no = crime.community_area_no WHERE community_area.community_area_name = 'Riverdale'
Database: chicago_crime
Note: domestic violence refers to domestic = 'TRUE'; uses "ward13@cityofchicago.org" refers to ward_email = 'ward13@cityofchicago.org';
Question: How many domestic violence cases were brought in the ward that uses "ward13@cityofchicago.org"?
SQL: SELECT sum(CASE WHEN crime.domestic = 'TRUE' THEN 1 ELSE 0 END) FROM ward INNER JOIN crime ON crime.ward_no = ward.ward_no WHERE ward.ward_email = 'ward13@cityofchicago.org'
Database: chicago_crime
Note: case JB107731 refers to case_number = 'JB107731';
Question: What is the district address associated with the case JB107731?
SQL: SELECT district.address FROM district INNER JOIN crime ON crime.district_no = district.district_no WHERE crime.case_number = 'JB107731'
Database: chicago_crime
Note: the central side refers to side = 'Central'; population of 50,000 and above refers to population > '50000'; total beat = sum(beat) where side = 'Central' and population > '50000';
Question: Calculate the total beat of the crimes reported in a community area in the central side with population of 50,000 and above.
SQL: SELECT 1.0 * sum(CASE WHEN community_area.population > 50000 THEN crime.beat ELSE 0 END) AS SUM FROM community_area INNER JOIN crime ON crime.community_area_no = community_area.community_area_no WHERE community_area.side = 'Central'
Database: chicago_crime
Note: crime against society refers to crime_against = 'Society'; in June 2018 refers to date LIKE '6/%/2018%';
Question: List the case number of crimes against society that happened in June 2018.
SQL: SELECT crime.case_number FROM fbi_code INNER JOIN crime ON crime.fbi_code_no = fbi_code.fbi_code_no WHERE crime.date LIKE '6/%/2018%' AND fbi_code.crime_against = 'Society'
Database: chicago_crime
Note: the highest population refers to max(population); domestic violence refers to domestic = 'TRUE'; percentage = divide(count(domestic = 'TRUE'), count(domestic)) where population = max(population) * 100%;
Question: Among the crimes located in the community area with the highest population, what is the percentage of domestic violence?
SQL: SELECT cast(count(CASE WHEN crime.domestic = 'TRUE' THEN crime.domestic END) AS REAL) * 100 / count(crime.domestic) FROM community_area INNER JOIN crime ON crime.community_area_no = community_area.community_area_no GROUP BY community_area.community_area_no HAVING count(community_area.population) ORDER BY count(community_area.population) DESC LIMIT 1
Database: chicago_crime
Note: population below 52000 refers to population < 52000; beat greater than the 90% of the average beat refers to beat > multiply(avg(beat), 0.9) where population < 52000;
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.
SQL: SELECT count(crime.report_no) FROM crime INNER JOIN ward ON crime.ward_no = ward.ward_no WHERE ward.population < 52000 AND crime.beat > ( SELECT avg(crime.beat) * 0.9 FROM crime INNER JOIN ward ON crime.ward_no = ward.ward_no WHERE ward.population < 52000 )
Database: chicago_crime
Note: area name refers to community_area_name; the Far north side refers to side = 'Far North'; a population of more than 50000 but less than 70000 refers to population BETWEEN '50000' AND '70000';
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.
SQL: SELECT community_area_name, side FROM community_area WHERE side = 'Far North ' AND population BETWEEN 50000 AND 70000
Database: chicago_crime
Note: coordinate refers to latitude, longitude; alley refers to location_description = 'ALLEY'; an arrest was made refers to arrest = 'TRUE';
Question: Give the coordinate of the alleys where a crime was reported and an arrest was made.
SQL: SELECT latitude, longitude FROM crime WHERE location_description = 'ALLEY' AND arrest = 'TRUE' GROUP BY latitude, longitude
Database: chicago_crime
Note: commander's name refers to commander; email address refers to email; phone number refers to phone;
Question: Find the commander's name, email address, and phone number of the Ogden district.
SQL: SELECT commander, email, phone FROM district WHERE district_name = 'Ogden'
Database: chicago_crime
Note: FBI code refers to fbi_code_no; definition refers to description; Gambling refers to title = 'Gambling';
Question: What is the FBI code and definition of Gambling?
SQL: SELECT fbi_code_no, description FROM fbi_code WHERE title = 'Gambling'
Database: chicago_crime
Note: severe refers to index_code = 'I'; percentage = divide(count(iucr_no where index_code = 'I'), count(iucr_no)) * 100%;
Question: Among the crimes, what percentage are severe?
SQL: SELECT cast(count(CASE WHEN index_code = 'I' THEN iucr_no ELSE NULL END) AS REAL) * 100 / count(iucr_no) FROM iucr
Database: chicago_crime
Note: "Austin" is the district_name; the most number of crime refers to Max(Count(case_number)); kind of location refers to location_description;
Question: What kind of location in Austin reported the most number of crimes?
SQL: SELECT crime.location_description FROM district INNER JOIN crime ON crime.district_no = district.district_no WHERE district.district_name = 'Austin' GROUP BY crime.location_description ORDER BY count(crime.case_number) DESC LIMIT 1
Database: chicago_crime
Note: average = Divide(Count(ward_no), Count(side));
Question: On average, how many community areas are there in a side?
SQL: SELECT cast(count(ward.ward_no) AS REAL) / count(DISTINCT community_area.side) FROM ward INNER JOIN crime ON crime.ward_no = ward.ward_no INNER JOIN community_area ON community_area.community_area_no = crime.community_area_no
Database: chicago_crime
Note: reported on the street refers to location_description = 'STREET'; community area with highest number of crime refers to Max(Count(location_description)); community area refers to community_area_no;
Question: Which community area has the highest number of crimes reported on the street?
SQL: SELECT community_area.community_area_no FROM community_area INNER JOIN crime ON crime.community_area_no = community_area.community_area_no WHERE crime.location_description = 'STREET' GROUP BY community_area.community_area_no ORDER BY count(crime.location_description) DESC LIMIT 1
Database: chicago_crime
Note: "RECKLESS HOMICIDE" is the secondary_description; average = Divide (Count(report_no), Count(district_name));
Question: What is the average number of reckless homicides that happened in a district?
SQL: SELECT cast(count(crime.report_no) AS REAL) / count(DISTINCT district.district_name) FROM district INNER JOIN crime ON crime.district_no = district.district_no INNER JOIN iucr ON iucr.iucr_no = crime.iucr_no WHERE iucr.secondary_description = 'RECKLESS HOMICIDE'
Database: chicago_crime
Note: the most crime without arrest refers to Max(Count(arrest = 'FALSE')); phone number refers to ward_office_phone; address refers to ward_office_address;
Question: Find the ward office's address and phone number of the ward where the most crimes without arrest occurred.
SQL: SELECT ward.ward_office_address, ward.ward_office_phone FROM crime INNER JOIN ward ON ward.ward_no = crime.ward_no WHERE crime.arrest = 'FALSE' GROUP BY ward.ward_office_address, ward.ward_office_phone ORDER BY count(crime.arrest) DESC LIMIT 1
Database: chicago_crime
Note: "CHILD ABDUCTION" is the secondary_description; coordinates refers to latitude, longitude;
Question: Give the case number and coordinates of the places where child abduction is reported.
SQL: SELECT crime.case_number, crime.latitude, crime.longitude FROM crime INNER JOIN iucr ON iucr.iucr_no = crime.iucr_no WHERE iucr.secondary_description = 'CHILD ABDUCTION'
Database: chicago_crime
Note: most reported crime refers to max(Count(secondary_description));
Question: What is the most reported crime in the Northwest side?
SQL: SELECT iucr.secondary_description FROM community_area INNER JOIN crime ON crime.community_area_no = community_area.community_area_no INNER JOIN iucr ON iucr.iucr_no = crime.iucr_no WHERE community_area.side = 'Northwest ' GROUP BY iucr.secondary_description ORDER BY count(*) DESC LIMIT 1
Database: chicago_crime
Note: least number of domestic crime refers to Min(Count(domestic = "TRUE")); community area refers to community_area_no;
Question: Find the community area where the least number of domestic crimes happened.
SQL: SELECT community_area.community_area_no FROM crime INNER JOIN community_area ON community_area.community_area_no = crime.community_area_no WHERE crime.domestic = 'TRUE' GROUP BY community_area.community_area_no ORDER BY count(community_area.community_area_no) ASC LIMIT 1
Database: chicago_crime
Note: drug abuse crime refer to title = 'Drug Abuse'; percentage = Divide (Count (secondary_description LIKE '%CANNABIS%'), Count (secondary_description)) * 100;
Question: In drug abuse crimes, what percentage is related to cannabis?
SQL: SELECT cast(count(CASE WHEN iucr.secondary_description LIKE '%CANNABIS%' THEN iucr.secondary_description END) AS REAL) * 100 / count(iucr.secondary_description) FROM iucr INNER JOIN crime ON crime.iucr_no = iucr.iucr_no INNER JOIN fbi_code ON fbi_code.fbi_code_no = crime.fbi_code_no WHERE fbi_code.title = 'Drug Abuse'
Database: chicago_crime
Note: day in February of 2018 refers to date LIKE '2/%/2018'; less severe crime refers to index_code = 'N'; average = Divide (Count(case_number), 28);
Question: What is the average number of less severe crimes reported a day in February of 2018?
SQL: SELECT cast(count(crime.case_number) AS REAL) / 28 FROM iucr INNER JOIN crime ON crime.iucr_no = iucr.iucr_no WHERE crime.date LIKE '2/%/2018%' AND iucr.index_code = 'N'
Database: chicago_crime
Note: "SOLICIT FOR PROSTITUTE" is the secondary_description; more than average refers to count(iucr_no) > Divide (Count(secondary_description = 'SOLICIT FOR PROSTITUTE'), Count(iucr_no)); name of community refers to community_area_name;
Question: List the name and population of the communities where more than average solicit for prostitutes were reported.
SQL: SELECT community_area.community_area_name, community_area.population FROM crime INNER JOIN community_area ON community_area.community_area_no = crime.community_area_no INNER JOIN iucr ON iucr.iucr_no = crime.iucr_no WHERE iucr.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 ) )
Database: chicago_crime
Note: "Harrison" is the district_name;  'Disorderly Conduct' is the title; percentage = Divide (Count(title = 'Disorderly Conduct'), Count(report_no)) * 100; incident report refers to report_no;
Question: Among the incidents reported in Harrison, what percentage are disorderly conduct?
SQL: SELECT count(CASE WHEN fbi_code.title = 'Disorderly Conduct' THEN crime.report_no END) * 100.0 / count(crime.report_no) AS per FROM district INNER JOIN crime ON crime.district_no = district.district_no INNER JOIN fbi_code ON fbi_code.fbi_code_no = crime.fbi_code_no WHERE district.district_name = 'Harrison'
Database: chicago_crime
Note: "VEHICULAR HIJACKING" and "AGGRAVATED VEHICULAR HIJACKING" are both secondary_description; difference in average = Subtract (Divide(Count(secondary_description = 'VEHICULAR HIJACKING'), Count(district_name)), Divide(Count(secondary_description = "AGGRAVATED VEHICULAR HIJACKING"), Count(district_name)));
Question: Calculate the difference in the average number of vehicular hijackings and aggravated vehicular hijackings in the districts.
SQL: SELECT round(cast(count(CASE WHEN iucr.secondary_description = 'VEHICULAR HIJACKING' THEN iucr.iucr_no END) AS REAL) / cast(count(DISTINCT CASE WHEN iucr.secondary_description = 'VEHICULAR HIJACKING' THEN district.district_name END) AS REAL) - cast(count(CASE WHEN iucr.secondary_description = 'AGGRAVATED VEHICULAR HIJACKING' THEN iucr.iucr_no END) AS REAL) / cast(count(DISTINCT CASE WHEN iucr.secondary_description = 'AGGRAVATED VEHICULAR HIJACKING' THEN district.district_name END) AS REAL), 4) AS "difference" FROM iucr INNER JOIN crime ON crime.iucr_no = iucr.iucr_no INNER JOIN district ON district.district_no = crime.district_no
Database: chicago_crime
Question: How many crimes happened in longitude -8772658001?
SQL: SELECT count(*) FROM crime WHERE longitude = '-87.72658001'
Database: chicago_crime
Note: narcotic type refers to primary_description = 'NARCOTICS'; crime refers to secondary_description;
Question: List all the crimes of the narcotic type that exist.
SQL: SELECT secondary_description FROM iucr WHERE primary_description = 'NARCOTICS' GROUP BY secondary_description
Database: chicago_crime
Note: more than 50000 inhabitants refers to population > 50000; first name of alderman refers to alderman_first_name;
Question: What is the first name of the aldermen of wards with more than 50,000 inhabitants?
SQL: SELECT alderman_first_name FROM ward WHERE population > 50000
Database: chicago_crime
Note: "Drug Abuse" is the title of crime;
Question: List crimes that the FBI has classified as Drug Abuse by their report number.
SQL: SELECT crime.report_no FROM fbi_code INNER JOIN crime ON crime.fbi_code_no = fbi_code.fbi_code_no WHERE fbi_code.title = 'Drug Abuse'
Database: chicago_crime
Note: "Calumet" is the district_name; 'WEAPON VIOLATION' is the primary_description of crime;
Question: How many weapons violation crimes have occurred in the Calumet district?
SQL: SELECT sum(CASE WHEN district.district_name = 'Calumet' THEN 1 ELSE 0 END) FROM iucr INNER JOIN crime ON crime.iucr_no = iucr.iucr_no INNER JOIN district ON district.district_no = crime.district_no WHERE iucr.primary_description = 'WEAPONS VIOLATION'
Database: chicago_crime
Note: Belmont Cragin community refers to community_area_name = 'Belmont Cragin'; exact location refers to latitude, longitude;
Question: What is the exact location of the crimes that occurred in the Belmont Cragin community?
SQL: SELECT crime.latitude, crime.longitude FROM community_area INNER JOIN crime ON crime.community_area_no = community_area.community_area_no WHERE community_area.community_area_name = 'Belmont Cragin' GROUP BY crime.latitude, crime.longitude
Database: chicago_crime
Note: "Hermosa" is the neighborhood_name;
Question: How many different types of crimes, according to the primary description, have occurred in the Hermosa neighborhood?
SQL: SELECT sum(CASE WHEN neighborhood.neighborhood_name = 'Hermosa' THEN 1 ELSE 0 END) FROM iucr INNER JOIN crime ON crime.iucr_no = iucr.iucr_no INNER JOIN community_area ON community_area.community_area_no = crime.community_area_no INNER JOIN neighborhood ON neighborhood.community_area_no = community_area.community_area_no
Database: chicago_crime
Note: domestic crime refers to domestic = 'TRUE'; person responsible for investigating refers to commander;
Question: How many domestic crime cases has Commander Ronald A. Pontecore Jr. been responsible for investigating?
SQL: SELECT sum(CASE WHEN crime.domestic = 'TRUE' THEN 1 ELSE 0 END) FROM district INNER JOIN crime ON crime.district_no = district.district_no WHERE district.commander = 'Ronald A. Pontecore Jr.'
Database: chicago_crime
Note: "Wentworth" is the district_name; crime against society refers to crime_against = 'Society";
Question: How many crimes against society happened in the Wentworth district according to the FBI?
SQL: SELECT sum(CASE WHEN fbi_code.crime_against = 'Society' THEN 1 ELSE 0 END) FROM fbi_code INNER JOIN crime ON crime.fbi_code_no = fbi_code.fbi_code_no INNER JOIN district ON district.district_no = crime.district_no WHERE district.district_name = 'Wentworth'
Database: chicago_crime
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?
SQL: SELECT district.phone FROM ward INNER JOIN crime ON crime.ward_no = ward.ward_no INNER JOIN district ON district.district_no = crime.district_no WHERE ward.alderman_first_name = 'Emma' AND ward.alderman_last_name = 'Mitts'
Database: chicago_crime
Note: lake view community refers to community_area_name = 'Lake View'; 'The theft of a motor vehicle' is the description;
Question: How many crimes described as 'The theft of a motor vehicle' by the FBI have taken place in the Lake View community?
SQL: SELECT sum(CASE WHEN community_area.community_area_name = 'Lake View' THEN 1 ELSE 0 END) FROM fbi_code INNER JOIN crime ON crime.fbi_code_no = fbi_code.fbi_code_no INNER JOIN community_area ON community_area.community_area_no = crime.community_area_no WHERE fbi_code.description = 'The theft of a motor vehicle.'
Database: chicago_crime
Note: more intimidation-type crime refers to Max(Count(primary_description = 'INTIMIDATION')); district refers to district_name;
Question: In which district have there been more intimidation-type crimes?
SQL: SELECT district.district_name FROM iucr INNER JOIN crime ON crime.iucr_no = iucr.iucr_no INNER JOIN district ON district.district_no = crime.district_no WHERE iucr.primary_description = 'INTIMIDATION' GROUP BY district.district_name ORDER BY count(iucr.primary_description) DESC LIMIT 1