db_id
stringclasses
68 values
question
stringlengths
24
325
evidence
stringlengths
0
580
SQL
stringlengths
23
728
food_inspection_2
When did Wing Hung Chop Suey Restaurant have its first inspection?
Wing Hung Chop Suey Restaurant refers to aka_name = 'WING HUNG CHOP SUEY RESTAURANT'; first inspection refers to min(inspection_date)
SELECT MIN(T2.inspection_date) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.aka_name = 'WING HUNG CHOP SUEY RESTAURANT'
food_inspection_2
How many restaurants were inspected on 2015/5/8?
restaurant refers to facility_type = 'Restaurant'; on 2015/5/8 refers to inspection_date = '2015-05-08'
SELECT COUNT(T2.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.inspection_date = '2015-05-08' AND T1.facility_type = 'Restaurant'
food_inspection_2
How many "food maintenance" related violations did inspection no.1454071 have?
"food maintenance" related refers to category = 'Food Maintenance'; inspection no.1454071 refers to inspection_id = '1454071'
SELECT COUNT(T2.point_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspection_id = '1454071' AND T1.category = 'Food Maintenance'
food_inspection_2
State the number of violations did Royal Thai Cuisine has during the 2015/5/8 inspection.
Royal Thai Cuisine refers to dba_name = 'ROYAL THAI CUISINE'; 2015/5/8 refers to inspection_date = '2015-05-08'
SELECT COUNT(T3.point_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T2.inspection_date = '2015-05-08' AND T1.dba_name = 'ROYAL THAI CUISINE'
food_inspection_2
For the grocery store located at "3635 W DIVERSEY AVE", how many inspections did it have?
grocery store refers to facility_type = 'Grocery Store'; "3635 W DIVERSEY AVE" refers to address = '3635 W DIVERSEY AVE'
SELECT COUNT(T2.inspection_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.address = '3635 W DIVERSEY AVE ' AND T1.facility_type = 'Grocery Store'
food_inspection_2
Who is responsible for most of the inspections? Give the full name.
full name refers to first_name, last_name; most of the inspections refers to max(count(employee_id))
SELECT T.first_name, T.last_name FROM ( SELECT T2.employee_id, T2.first_name, T2.last_name, COUNT(T1.inspection_id) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id GROUP BY T2.employee_id, T2.first_name, T2.last_name ORDER BY COUNT(T1.inspection_id) DESC LIMIT 1 ) AS T
food_inspection_2
How many inspections done by Lisa Tillman ended up with the result of "Out of Business"?
the result of "Out of Business" refers to results = 'Out of Business'
SELECT COUNT(T1.inspection_id) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T2.first_name = 'Lisa' AND T2.last_name = 'Tillman' AND T1.results = 'Out of Business'
food_inspection_2
Show the phone number of the sanitarian who was responsible for inspection no.634597.
phone number refers to phone; sanitarian refers to title = 'Sanitarian'; inspection no.634597 refers to inspection_id = '634597'
SELECT T2.phone FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T1.inspection_id = 634597 AND T2.title = 'Sanitarian'
food_inspection_2
State the salary of the employee who did the most inspections.
the most inspections refers to max(count(employee_id))
SELECT T1.salary FROM employee AS T1 INNER JOIN ( SELECT T.employee_id, COUNT(T.inspection_id) FROM inspection AS T GROUP BY T.employee_id ORDER BY COUNT(T.inspection_id) DESC LIMIT 1 ) AS T2 ON T1.employee_id = T2.employee_id
food_inspection_2
What is the average number of inspections did risk level 3 taverns have?
risk level 3 refers to risk_level = '3'; tavern refers to facility_type = 'TAVERN'; average number = divide(count(inspection_id), sum(license_no)) where risk_level = '3' and facility_type = 'TAVERN'
SELECT CAST(COUNT(T2.inspection_id) AS REAL) / COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.risk_level = 3 AND T1.facility_type = 'TAVERN'
food_inspection_2
State the inspection pass rate of Pockets Restaurant.
Pockets refers to dba_name = 'POCKETS'; Restaurant refers to facility_type = 'Restaurant'; pass refers to results = 'Pass'; the inspection pass rate = divide(sum(inspection_id where results = 'Pass'), count(license_no)) where dba_name = 'POCKETS' and facility_type = 'Restaurant'
SELECT CAST(COUNT(CASE WHEN T2.results = 'Pass' THEN T2.inspection_id ELSE NULL END) AS REAL) * 100 / COUNT(T2.inspection_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.dba_name = 'POCKETS' AND T1.facility_type = 'Restaurant'
food_inspection_2
How many sanitarian employees in Chicago are from the zip code 60617?
sanitarian refers to title = 'Sanitarian'; in Chicago refers to city = 'Chicago'; zip code 60617 refers to zip = 60617
SELECT COUNT(employee_id) FROM employee WHERE zip = '60617'
food_inspection_2
What is the assumed name of the business located at 2903 W Irving Park Rd?
assumed name refers to dba_name; 2903 W Irving Park Rd refers to address = '2903 W IRVING PARK RD '
SELECT DISTINCT dba_name FROM establishment WHERE address = '2903 W IRVING PARK RD '
food_inspection_2
What is the full name of the employee with the lowest salary?
full name refers to first_name, last_name; the lowest salary refers to min(salary)
SELECT first_name, last_name FROM employee ORDER BY salary ASC LIMIT 1
food_inspection_2
How many establishments that are doing business as Homemade Pizza have a risk level of 2?
Homemade Pizza refers to dba_name = 'HOMEMADE PIZZA'; a risk level of 2 refers to risk_level = 2
SELECT COUNT(license_no) FROM establishment WHERE risk_level = 2 AND dba_name = 'HOMEMADE PIZZA'
food_inspection_2
How many inspections with critical food safety problems are under inspection point id 3?
critical food safety problems refers to fine = 500; point_id = 3
SELECT COUNT(inspection_id) FROM violation WHERE point_id = 3 AND fine = 500
food_inspection_2
How many employees are under Gregory Cardenas?
SELECT COUNT(T1.employee_id) FROM employee AS T1 WHERE T1.supervisor = ( SELECT employee_id FROM employee WHERE first_name = 'Gregory' AND last_name = 'Cardenas' )
food_inspection_2
When did Renaldi's Pizza had its first inspection?
Renaldi's Pizza refers to dba_name = 'RENALDI''S PIZZA'; first inspection refers to min(inspection_date)
SELECT MIN(T2.inspection_date) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.dba_name = 'RENALDI''S PIZZA'
food_inspection_2
Out of all the short form complaint inspections done by David Hodges, how many businesses passed?
short form complaint inspection refers to inspection_type = 'Short Form Complaint'; pass refers to results = 'Pass'
SELECT COUNT(DISTINCT T2.license_no) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T1.first_name = 'David' AND T1.last_name = 'Hodges' AND T1.employee_id = 153225 AND T2.inspection_type = 'Short Form Complaint' AND T2.results = 'Pass'
food_inspection_2
How many businesses from ward 42 have at least 5 failed inspection results between 1/1/2010 to 12/31/2015?
ward 42 refers to ward = 42; at least 5 failed inspection results refers to count(results = 'Fail') > = 5; between 1/1/2010 to 12/31/2015 refers to inspection_date between '2010-01-01' and '2015-12-31'
SELECT COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.inspection_date BETWEEN '2010-01-01' AND '2015-12-31' AND T1.ward = 42 AND T1.license_no IN ( SELECT license_no FROM ( SELECT license_no FROM inspection WHERE results = 'Fail' GROUP BY license_no HAVING COUNT(results) >= 5 ) )
food_inspection_2
How much is the salary of the employee who has the highest number of inspections done of all time?
the highest number of inspections done refers to max(count(employee_id))
SELECT T1.salary FROM employee AS T1 INNER JOIN ( SELECT employee_id, COUNT(inspection_id) FROM inspection GROUP BY employee_id ORDER BY COUNT(inspection_id) DESC LIMIT 1 ) AS T2 ON T1.employee_id = T2.employee_id
food_inspection_2
What is the precise location of the establishment with the highest number of failed inspections?
precise location refers to latitude, longitude; the highest number of failed inspections refers to max(count(results where results = 'Fail'))
SELECT T1.latitude, T1.longitude FROM establishment AS T1 INNER JOIN ( SELECT license_no FROM inspection WHERE results = 'Fail' GROUP BY license_no ORDER BY COUNT(results) DESC LIMIT 1 ) AS T2 ON T1.license_no = T2.license_no
food_inspection_2
What are the comments of the inspector during the inspection of Taqueria La Fiesta on 1/25/2010?
comment of the inspector refers to inspector_comment; Taqueria La Fiesta refers to dba_name = 'TAQUERIA LA FIESTA'; on 1/25/2010 refers to inspection_date = '2010-01-25'
SELECT T3.inspector_comment FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T2.inspection_date = '2010-01-25' AND T1.dba_name = 'TAQUERIA LA FIESTA'
food_inspection_2
List the full names of the employees who were responsible for inspecting Taqueria La Paz.
full name refers to first_name, last_name; Taqueria La Paz refers to dba_name = 'TAQUERIA LA PAZ'
SELECT DISTINCT T3.first_name, T3.last_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T1.dba_name = 'TAQUERIA LA PAZ'
food_inspection_2
What is the full name of the employee who gave the highest amount of fine of all time?
full name refers to first_name, last_name; the highest amount of fine refers to max(sum(fine))
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, SUM(T3.fine) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id GROUP BY T1.first_name, T1.last_name ORDER BY SUM(T3.fine) DESC LIMIT 1 ) t
food_inspection_2
Which business had the highest number of inspections done? Calculate the percentage of passed and failed inspections of the said business.
business name refers to dba_name; the highest number of inspections done max(count(inspection_id)); percentage of passed inspections = divide(sum(inspection_id where results = 'Pass'), total(inspection_id)) * 100%; percentage of failed inspections = divide(sum(inspection_id where results = 'Fail'), total(inspection_id)) * 100%
SELECT T2.dba_name , CAST(SUM(CASE WHEN T1.results = 'Pass' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.inspection_id) AS percentagePassed , CAST(SUM(CASE WHEN T1.results = 'Fail' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.inspection_id) FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no GROUP BY T2.dba_name ORDER BY COUNT(T1.license_no) DESC LIMIT 1
food_inspection_2
What is the employee's last name at 7211 S Hermitage Ave, Chicago, IL?
7211 S Hermitage Ave refers to address = '7211 S Hermitage Ave'; Chicago refers to city = 'Chicago'; IL refers to state = 'IL'
SELECT last_name FROM employee WHERE address = '7211 S Hermitage Ave' AND city = 'Chicago' AND state = 'IL'
food_inspection_2
What is the establishment's name and employee involved in the inspection ID 44256 on May 5, 2010?
establishment's name refers to dba_name; employee name refers to first_name, last_name; inspection ID 44256 refers to inspection_id = 44256; on May 5, 2010 refers to inspection_date = '2010-05-05'
SELECT T1.dba_name, T3.first_name, T3.last_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T2.inspection_date = '2010-05-05' AND T2.inspection_id = 44256
food_inspection_2
What is the employee's full name involved in the canvass inspection type on March 09, 2010?
full name refers to first_name, last_name; canvass inspection type refers to inspection_type = 'Canvass'; on March 09, 2010 refers to inspection_date = '2010-03-09'
SELECT DISTINCT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_date = '2010-03-09' AND T2.inspection_type = 'Canvass'
food_inspection_2
Provide the inspection ID of the establishment named "PIZZA RUSTICA, INC."
"PIZZA RUSTICA, INC." refers to dba_name = 'PIZZA RUSTICA, INC'
SELECT DISTINCT T2.inspection_id FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.dba_name = 'PIZZA RUSTICA, INC'
food_inspection_2
How many restaurants with the highest risk level still passed the inspection?
restaurant refers to facility_type = 'Restaurant'; the highest risk level refers to max(risk_level); pass the inspection refers to results = 'Pass'
SELECT COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.risk_level = 3 AND T2.results = 'Pass' AND T1.facility_type = 'Restaurant'
food_inspection_2
List the names of employees involved in an inspection with the Display of Inspection Report Summary category.
name refers to first_name, last_name; Display of Inspection Report Summary category refers to category = 'Display of Inspection Report Summary'
SELECT DISTINCT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id INNER JOIN inspection_point AS T4 ON T3.point_id = T4.point_id WHERE T4.category = 'Display of Inspection Report Summary'
food_inspection_2
What is the title of the employee involved in inspection ID 60332?
SELECT T1.title FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 60332
food_inspection_2
How many of the restaurants with the lowest risk level failed the complaint inspection type?
restaurant refers to facility_type = 'Restaurant'; the lowest risk level refers to min(risk_level); failed refers to results = 'Fail'; the complaint inspection type refers to inspection_type = 'Complaint'
SELECT COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.risk_level = '1' AND T2.inspection_type = 'Complaint' AND T1.facility_type = 'Restaurant' AND T2.results = 'Fail'
food_inspection_2
Provide the fine paid and the complete address of the establishment with inspection ID 48216.
complete address refers to state, city, address
SELECT DISTINCT T3.fine, T1.state, T1.city, T1.address FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T2.inspection_id = 48216
food_inspection_2
What is the inspection ID of the inspection with critical point level, $500 fine, and inspector comment "CDI ON 5-17-10"?
critical point level refers to point_level = 'Critical'; $500 fine refers to fine = 500; inspector comment "CDI ON 5-17-10" refers to inspector_comment = 'CDI ON 5-17-10'
SELECT T2.inspection_id FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.fine = 500 AND T1.point_level = 'Critical' AND T2.inspector_comment = 'CDI ON 5-17-10'
food_inspection_2
What are the inspection description and inspector's comments in the inspection ID 164795?
inspection description refers to Description; inspector's comment refers to inspector_comment
SELECT T1.Description, T2.inspector_comment FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspection_id = 44247
food_inspection_2
What are the inspector's comments and clean operating requirement code for inspection ID 54216 and point ID 34?
inspector's comment refers to inspector_comment; clean operating requirement code refers to code
SELECT T2.inspector_comment, T1.code FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspection_id = 54216 AND T2.point_id = 34
food_inspection_2
Among the establishments that failed in the inspection, what is the percentage of establishments with the highest risk level?
failed in inspection refers to results = 'Fail'; the highest risk level refers to max(risk_level); percentage = divide(count(license_no where risk_level = max(risk_level)), count(license_no)) * 100% where results = 'Fail'
SELECT CAST(COUNT(CASE WHEN T1.risk_level = 3 THEN T1.license_no END) AS REAL) * 100 / COUNT(T1.risk_level) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.results = 'Fail'
food_inspection_2
Among the employees that receive a salary between $75000 to $85000, what is the difference between the number of employees which undergone an inspection that fined 100 and 500?
salary between $75000 and $85000 refers to 75000 < = salary < = 80000; difference = subtract(count(inspection_id where fine = 100), count(inspection_id where fine = 500)) where 75000 < = salary < = 80000
SELECT SUM(CASE WHEN T3.fine = 100 THEN 1 ELSE 0 END) - SUM(CASE WHEN T3.fine = 500 THEN 1 ELSE 0 END) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.salary BETWEEN 75000 AND 80000
food_inspection_2
Calculate the percentage of inspections with the fine for a minor food safety problem.
fine for a minor food safety problem refers to fine = 100; percentage = divide(count(inspection_id where fine = 100), sum(inspection_id)) * 100%
SELECT CAST(COUNT(CASE WHEN fine = 100 THEN inspection_id END) AS REAL) * 100 / COUNT(inspection_id) FROM violation
food_inspection_2
List the point IDs and fines of the inspections done on 7th August 2010.
on 7th August 2010 refers to inspection_date = '2010-08-07'
SELECT T2.point_id, T2.fine FROM inspection AS T1 INNER JOIN violation AS T2 ON T1.inspection_id = T2.inspection_id WHERE T1.inspection_date = '2010-08-07'
food_inspection_2
How many inspections were done under the personnel category?
under the personnel category refers to category = 'Personnel'
SELECT COUNT(T1.inspection_id) FROM violation AS T1 INNER JOIN inspection_point AS T2 ON T1.point_id = T2.point_id WHERE T2.category = 'Personnel'
food_inspection_2
Provide the names and inspection results of the facilities located in Burnham.
names refers to dba_name; inspection result refers to results; in Burnham refers to city = 'BURNHAM'
SELECT DISTINCT T1.dba_name, T2.results FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.city = 'BURNHAM'
food_inspection_2
Compare the number of inspections under toxic items and no-smoking regulations.
under toxic items refers to category = 'Toxic Items'; no-smoking regulations refers to category = 'No Smoking Regulations'
SELECT COUNT(CASE WHEN T2.category = 'Toxic Items' THEN T1.inspection_id END) AS Tox_nums , COUNT(CASE WHEN T2.category = 'No Smoking Regulations' THEN T1.inspection_id END) AS NosmoNums FROM violation AS T1 INNER JOIN inspection_point AS T2 ON T1.point_id = T2.point_id
food_inspection_2
Which facilities were inspected by Sarah Lindsey on 20th November 2012?
facility name refers to dba_name; on 20th November 2012 refers to inspection_date = '2012-11-20'
SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T2.inspection_date = '2012-11-20' AND T3.first_name = 'Sarah' AND T3.last_name = 'Lindsey'
food_inspection_2
How many inspections were done under the display of inspection report summary category?
under the display of inspection report summary category refers to category = 'Display of Inspection Report Summary'
SELECT COUNT(T2.inspection_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.category = 'Display of Inspection Report Summary'
food_inspection_2
List the types and results of the inspections done on Riverwalk café.
type refers to inspection_type; Riverwalk café refers to facility_type = 'RIVERWALK CAFE'
SELECT T2.inspection_type, T2.results FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.facility_type = 'RIVERWALK CAFE'
food_inspection_2
Who inspected Jean Samocki and what was the result?
employee's name refers to first_name, last_name; Jean Samocki refers to dba_name = 'JEAN SAMOCKI'
SELECT T3.first_name, T3.last_name, T2.results FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T1.dba_name = 'JEAN SAMOCKI'
food_inspection_2
How much did Hacienda Los Torres from ward 36 fine for failing an inspection?
Hacienda Los Torres refers to dba_name = 'HACIENDA LOS TORRES'; ward 36 refers to ward = 36; failing an inspection refers to results = 'Fail';
SELECT SUM(T3.fine) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.dba_name = 'HACIENDA LOS TORRES' AND T1.ward = 36 AND T2.results = 'Fail'
food_inspection_2
Calculate the total amount of fine under the food equipment and utensil category.
under the food equipment and utensil category refers to category = 'Food Equipment and Utensil'
SELECT SUM(T2.fine) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.category = 'Food Equipment and Utensil'
food_inspection_2
Provide the names and locations of the facilities that failed inspections on 29th July 2013.
name refers to dba_name; location refers to latitude, longitude; failed inspections refers to results = 'Fail'; on 29th July 2013 refers to inspection_date = '2013-07-29'
SELECT T2.dba_name, T2.longitude, T2.latitude FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE T1.inspection_date = '2013-07-29' AND T1.results = 'Fail'
food_inspection_2
Calculate the percentage of inspections with verified quality. Among them, how many businesses were from Chicago?
verified quality refers to results like 'Pass%'; from Chicago refers to city = 'CHICAGO'; percentage = divide(count(inspection_id where results like 'Pass%'), sum(inspection_id)) * 100%
SELECT CAST(COUNT(CASE WHEN T2.results LIKE '%Pass%' THEN T2.inspection_id END) AS REAL) * 100 / COUNT(T2.inspection_id), COUNT(DISTINCT T2.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.city = 'CHICAGO'
food_inspection_2
Provide the first name of employee who did inspection ID 48225?
SELECT T1.first_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 48225
food_inspection_2
Tell the address of employee who did inspection ID 52238?
SELECT T1.address FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 52238
food_inspection_2
Write down the last name of employee who did inspection ID 52238?
SELECT T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 52238
food_inspection_2
What is the inspection result for inspection done by Thomas Langley?
inspection result refers to results
SELECT DISTINCT T2.results FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T1.first_name = 'Thomas' AND T1.last_name = 'Langley'
food_inspection_2
List down the address of employees who did inspection dated 11/5/2010.
dated 11/5/2010 refers to inspection_date = '2010-11-05'
SELECT DISTINCT T1.address FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_date = '2010-11-05'
food_inspection_2
List down the phone numbers of employees who did Canvass inspection.
phone number refers to phone; Canvass inspection refers to inspection_type = 'Canvass'
SELECT DISTINCT T1.phone FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_type = 'Canvass'
food_inspection_2
What is the job title of employee who did inspection ID 52269?
job title refers to title
SELECT T1.title FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 52269
food_inspection_2
What are the inspection results for Xando Coffee & Bar / Cosi Sandwich Bar?
Xando Coffee & Bar / Cosi Sandwich Bar refers to dba_name = 'XANDO COFFEE & BAR / COSI SANDWICH BAR'
SELECT DISTINCT T2.results FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.dba_name = 'XANDO COFFEE & BAR / COSI SANDWICH BAR'
food_inspection_2
What type of inspection was done at John Schaller?
type of inspection refers to inspection_type; John Schaller refers to dba_name = 'JOHN SCHALLER'
SELECT DISTINCT T2.inspection_type FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.dba_name = 'JOHN SCHALLER'
food_inspection_2
List down the dba name of restaurants that were inspected due to license.
inspected due to license refers to inspection_type = 'License'
SELECT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.inspection_type = 'License'
food_inspection_2
State the name of dbas with verified quality.
name of dba refers to dba_name; with verified quality refers to results = 'Pass' or results = 'Pass w/Conditions'
SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.results LIKE '%Pass%'
food_inspection_2
Calculate the total salary for employees who did inspection from ID 52270 to 52272.
inspection from ID 52270 to 52272 refers to inspection_id between 52270 and 52272
SELECT SUM(T2.salary) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T1.inspection_id BETWEEN 52270 AND 52272
food_inspection_2
Calculate the average salary for employees who did inspection on License Re-Inspection.
inspection on License Re-Inspection refers to inspection_type = 'License Re-Inspection'; average salary = avg(salary)
SELECT AVG(T2.salary) FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id WHERE T1.inspection_type = 'License Re-Inspection'
food_inspection_2
Did license number 1222441 pass the inspection and what is the zip code number of it?
license number 1222441 refers to license_no = 1222441; result of the inspection refers to results; zip code number refers to zip
SELECT DISTINCT T2.results, T1.zip FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.license_no = 1222441
food_inspection_2
What is the full name of the employee that inspected establishments with license 1334073?
full name refers to first_name, last_name; with license 1334073 refers to license_no = 1334073
SELECT DISTINCT T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.license_no = 1334073
food_inspection_2
Which establishments did Joshua Rosa inspect?
establishment name refers to dba_name
SELECT DISTINCT T3.dba_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T1.first_name = 'Joshua' AND T1.last_name = 'Rosa'
food_inspection_2
How many employees have salary greater than 70000 but fail the inspection?
salary greater than 70000 refers to salary > 70000; fail the inspection refers to results = 'Fail'
SELECT COUNT(DISTINCT T1.employee_id) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.results = 'Fail' AND T1.salary > 70000
food_inspection_2
What is the name of the establishment that Joshua Rosa inspected?
name of the establishment refers to dba_name
SELECT DISTINCT T3.dba_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T1.first_name = 'Joshua' AND T1.last_name = 'Rosa'
food_inspection_2
What is the risk level of the establishment that Bob Benson inspected?
SELECT DISTINCT T3.risk_level FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id INNER JOIN establishment AS T3 ON T2.license_no = T3.license_no WHERE T1.first_name = 'Bob' AND T1.last_name = 'Benson'
food_inspection_2
What is the title of the employee that inspected the establishment with license number 1576687?
license number 1576687 refers to license_no = 1576687
SELECT DISTINCT T1.title FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.license_no = 1576687
food_inspection_2
How many inspection points with serious point level that have no fine?
serious point level refers to point_level = 'Serious '; have no fine refers to fine = 0
SELECT COUNT(DISTINCT T2.point_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.point_level = 'Serious ' AND T2.fine = 0
food_inspection_2
What is the percentage of restaurants that paid a fine of 250 among all establishments?
a fine of 250 refers to fine = 250; percentage = divide(sum(license_no where fine = 250), count(license_no)) * 100%
SELECT CAST(COUNT(CASE WHEN T3.fine = 250 THEN T1.license_no END) AS REAL) * 100 / COUNT(T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.facility_type = 'Restaurant'
food_inspection_2
What is the percentage of establishments with a risk level of 1 among all of the establishments that passed the inspection?
a risk level of 1 refers to risk_level = 1; pass the inspection refers to results = 'Pass'; percentage = divide(sum(license_no where risk_level = 1), count(license_no)) * 100% where results = 'Pass'
SELECT CAST(COUNT(CASE WHEN T1.risk_level = 1 THEN T1.license_no END) AS REAL) * 100 / COUNT(T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.results = 'Pass'
food_inspection_2
Where does the employee named "Standard Murray" live?
address refers to address, city, state
SELECT address, city, state FROM employee WHERE first_name = 'Standard' AND last_name = 'Murray'
food_inspection_2
What is the facility type of the establishment named "Kinetic Playground"?
the establishment named "Kinetic Playground" refers to dba_name = 'Kinetic Playground'
SELECT facility_type FROM establishment WHERE dba_name = 'Kinetic Playground'
food_inspection_2
How much salary does Jessica Anthony receive?
SELECT salary FROM employee WHERE first_name = 'Jessica' AND last_name = 'Anthony'
food_inspection_2
Among the list of employees, what is the total number of supervisors?
supervisor refers to title = 'Supervisor'
SELECT COUNT(employee_id) FROM employee WHERE title = 'Supervisor'
food_inspection_2
Where in Chicago does the restaurant named "Old Timers Rest & Lounge" located?
in Chicago refers to city = 'CHICAGO'; restaurant refers to facility_type = 'Restaurant'; "Old Timers Rest & Lounge" refers to dba_name = 'OLD TIMERS REST & LOUNGE'; location refers to address
SELECT address FROM establishment WHERE city = 'CHICAGO' AND dba_name = 'OLD TIMERS REST & LOUNGE' AND facility_type = 'Restaurant'
food_inspection_2
How many employees are living in Hoffman Estates, IL?
in Hoffman Estates refers to city = 'Hoffman Estates'; IL refers to state = 'IL'
SELECT COUNT(employee_id) FROM employee WHERE state = 'IL' AND city = 'Hoffman Estates'
food_inspection_2
What is the total number of establishments with the highest risk level?
total number of establishments with the highest risk level = count(max(risk_level))
SELECT COUNT(license_no) FROM establishment WHERE risk_level = 3
food_inspection_2
Who is the employee that receives 82700 as their salary?
employee name refers to first_name, last_name; receives 82700 as salary refers to salary = 82700
SELECT first_name, last_name FROM employee WHERE salary = 82700
food_inspection_2
Provide the last name of the employee involved in the inspection ID 52256.
SELECT DISTINCT T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 52256
food_inspection_2
Please list the names of taverns that paid a $100 fine upon inspection.
name refers to dba_name; tavern refers to facility_type = 'Tavern'; a $100 fine refers to fine = 100
SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.facility_type = 'Tavern' AND T3.fine = 100
food_inspection_2
List point level of inspections with no fine.
no fine refers to fine = 0
SELECT DISTINCT T1.point_level FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.fine = 0
food_inspection_2
Provide the facility type and license number of establishments with the lowest risk level but failed the inspection.
license number refers to license_no; the lowest risk level refers to min(risk_level); failed the inspection refers to results = 'Fail'
SELECT DISTINCT T1.facility_type, T1.license_no FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.risk_level = 1 AND T2.results = 'Fail'
food_inspection_2
What is the result of the February 24, 2010 inspection involving the employee named "Arnold Holder"?
February 24, 2010 refers to inspection_date = '2010-02-24'
SELECT DISTINCT T2.results FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_date = '2010-02-24' AND T1.first_name = 'Arnold' AND T1.last_name = 'Holder'
food_inspection_2
List all inspection IDs where the employee named "Rosemary Kennedy" was involved.
SELECT DISTINCT T2.inspection_id FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T1.first_name = 'Rosemary' AND T1.last_name = 'Kennedy'
food_inspection_2
What type of inspection was done on July 07, 2010, involving the employee named "Lisa Tillman"?
type of inspection refers to inspection_type; on July 07, 2010 refers to inspection_date = '2010-07-07'
SELECT DISTINCT T2.inspection_type FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T1.first_name = 'Lisa' AND T1.last_name = 'Tillman' AND T2.inspection_date = '2010-07-07'
food_inspection_2
Provide the inspection ID of the inspection with the comment "MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA" and sanitary operating requirement code of 7-38-030, 015, 010 (A), 005 (A).
comment "MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA" refers to inspector_comment = 'MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA'; sanitary operating requirement code of 7-38-030, 015, 010 (A), 005 (A) refers to code = '7-38-030, 015, 010 (A), 005 (A)'
SELECT T2.inspection_id FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T2.inspector_comment = 'MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA' AND T1.code = '7-38-030, 015, 010 (A), 005 (A)'
food_inspection_2
List down the names of the establishments with the highest risk level and failed the inspection.
name of establishment refers to dba_name; the highest risk level refers to max(risk_level); failed the inspection refers to results = 'Fail'
SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T1.risk_level = 3 AND T2.results = 'Fail'
food_inspection_2
What is the inspection ID where the employee named "David Hodges" is currently employed in the "Kamayan Express" establishment?
the "Kamayan Express" establishment refers to dba_name = 'KAMAYAN EXPRESS'
SELECT T2.inspection_id FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id WHERE T3.first_name = 'David' AND T3.last_name = 'Hodges' AND T1.dba_name = 'KAMAYAN EXPRESS'
food_inspection_2
List down the inspection ID with the inspector's comment "A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served. NO CERTIFIED FOOD MANAGER ON DUTY AT THIS TIME FOODS ARE COOKED AND SERVED SERIOUS CITATION ISSUED" and inspection category of Personnel.
inspector's comment "A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served. NO CERTIFIED FOOD MANAGER ON DUTY AT THIS TIME FOODS ARE COOKED AND SERVED SERIOUS CITATION ISSUED" refers to inspector_comment = 'A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served.FOUND NO CITY OF CHICAGO SANITATION CERTIFICATE POSTED OR VALID DOCUMENTATION DURING THIS INSPECTION.'; inspection category of Personnel refers to category = 'Personnel'
SELECT T2.inspection_id FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.category = 'Personnel' AND T2.inspector_comment = 'A certified food service manager must be present in all establishments at which potentially hazardous food is prepared or served.FOUND NO CITY OF CHICAGO SANITATION CERTIFICATE POSTED OR VALID DOCUMENTATION DURING THIS INSPECTION.'
food_inspection_2
How many grocery stores paid $250 fine upon their inspection?
grocery store refers to facility_type = 'Grocery Store'; $250 fine refers to fine = 250
SELECT COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id WHERE T1.facility_type = 'Grocery Store' AND T3.fine = 250
food_inspection_2
What is the category of the inspection of the establishment named "J & J FOOD"?
the establishment named "J & J FOOD" refers to dba_name = 'J & J FOOD'
SELECT DISTINCT T4.category FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id INNER JOIN inspection_point AS T4 ON T3.point_id = T4.point_id WHERE T1.dba_name = 'J & J FOOD'
food_inspection_2
How many of the inspections with serious point levels have no fines?
serious point level refers to point_level = 'Serious'; no fines refers to fine = 0
SELECT COUNT(DISTINCT T2.inspection_id) FROM inspection_point AS T1 INNER JOIN violation AS T2 ON T1.point_id = T2.point_id WHERE T1.point_level = 'Serious ' AND T2.fine = 0
food_inspection_2
What is the establishment's name with an inspection category of No Smoking Regulations?
establishment's name refers to dba_name; an inspection category of No Smoking Regulations refers to category = 'No Smoking Regulations'
SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no INNER JOIN violation AS T3 ON T2.inspection_id = T3.inspection_id INNER JOIN inspection_point AS T4 ON T3.point_id = T4.point_id WHERE T4.category = 'No Smoking Regulations'
food_inspection_2
What is the difference in the number of restaurants that passed and failed the canvass inspection type?
canvass inspection type refers to inspection_type = 'Canvass'; restaurant refers to facility_type = 'Restaurant'; difference = subtract(count(inspection_id where results = 'Pass'), count(inspection_id where results = 'Fail'))
SELECT COUNT(CASE WHEN T2.results = 'Pass' THEN T1.license_no END) - COUNT(CASE WHEN T2.results = 'Fail' THEN T1.license_no END) AS diff FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE T2.inspection_type = 'Canvass' AND T1.facility_type = 'Restaurant'