problem
stringlengths 121
422
| db_id
stringclasses 69
values | solution
stringlengths 23
804
|
---|---|---|
Write SQL query to solve given problem: State the salary of the employee who did the most inspections.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: What is the average number of inspections did risk level 3 taverns have?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: State the inspection pass rate of Pockets Restaurant.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: How many sanitarian employees in Chicago are from the zip code 60617?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT COUNT(employee_id) FROM employee WHERE zip = '60617' |
Write SQL query to solve given problem: What is the assumed name of the business located at 2903 W Irving Park Rd?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT DISTINCT dba_name FROM establishment WHERE address = '2903 W IRVING PARK RD ' |
Write SQL query to solve given problem: What is the full name of the employee with the lowest salary?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT first_name, last_name FROM employee ORDER BY salary ASC LIMIT 1 |
Write SQL query to solve given problem: How many establishments that are doing business as Homemade Pizza have a risk level of 2?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT COUNT(license_no) FROM establishment WHERE risk_level = 2 AND dba_name = 'HOMEMADE PIZZA' |
Write SQL query to solve given problem: How many inspections with critical food safety problems are under inspection point id 3?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT COUNT(inspection_id) FROM violation WHERE point_id = 3 AND fine = 500 |
Write SQL query to solve given problem: How many employees are under Gregory Cardenas?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' ) |
Write SQL query to solve given problem: When did Renaldi's Pizza had its first inspection?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: What is the full name of the employee who was responsible for the most inspection in March 2016?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT T3.first_name, T3.last_name FROM ( SELECT T1.employee_id, COUNT(T1.inspection_id) FROM inspection AS T1 WHERE strftime('%Y-%m', T1.inspection_date) = '2016-03' GROUP BY T1.employee_id ORDER BY COUNT(T1.inspection_id) DESC LIMIT 1 ) AS T2 INNER JOIN employee AS T3 ON T2.employee_id = T3.employee_id |
Write SQL query to solve given problem: What are the names of the businesses that passed with conditions in May 2012?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT DISTINCT T2.dba_name FROM inspection AS T1 INNER JOIN establishment AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y-%m', T1.inspection_date) = '2012-05' AND T1.results = 'Pass w/ Conditions' |
Write SQL query to solve given problem: Out of all the short form complaint inspections done by David Hodges, how many businesses passed?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: How many businesses from ward 42 have at least 5 failed inspection results between 1/1/2010 to 12/31/2015?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 ) ) |
Write SQL query to solve given problem: How much is the salary of the employee who has the highest number of inspections done of all time?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: What is the assumed name of the business that has the highest total fine in 2014?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT T.dba_name FROM ( SELECT T1.dba_name, 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 strftime('%Y', T2.inspection_date) = '2014' GROUP BY T1.dba_name ORDER BY SUM(T3.fine) DESC LIMIT 1 ) AS T |
Write SQL query to solve given problem: What is the precise location of the establishment with the highest number of failed inspections?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: What are the comments of the inspector during the inspection of Taqueria La Fiesta on 1/25/2010?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: How much is the total fine given to Ron of Japan Inc in its inspection done on February 2014?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 strftime('%Y-%m', T2.inspection_date) = '2014-02' AND T1.dba_name = 'RON OF JAPAN INC' |
Write SQL query to solve given problem: List the full names of the employees who were responsible for inspecting Taqueria La Paz.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: What is the full name of the employee who gave the highest amount of fine of all time?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: What is the average number of inspections done by the top 5 employees with the highest salary? List the names of the said employees.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT CAST(COUNT(DISTINCT T2.inspection_id) AS REAL) / 5, T1.first_name, T1.last_name FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T1.title = 'Sanitarian' ORDER BY T1.salary DESC LIMIT 5 |
Write SQL query to solve given problem: Which business had the highest number of inspections done? Calculate the percentage of passed and failed inspections of the said business.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: What is the employee's last name at 7211 S Hermitage Ave, Chicago, IL?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT last_name FROM employee WHERE address = '7211 S Hermitage Ave' AND city = 'Chicago' AND state = 'IL' |
Write SQL query to solve given problem: What is the establishment's name and employee involved in the inspection ID 44256 on May 5, 2010?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: Give the address of the schools that passed the inspection in March 2010.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT DISTINCT T1.address FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y-%m', T2.inspection_date) = '2010-03' AND T2.results = 'Pass' AND T1.facility_type = 'School' |
Write SQL query to solve given problem: What is the employee's full name involved in the canvass inspection type on March 09, 2010?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Provide the inspection ID of the establishment named "PIZZA RUSTICA, INC.". Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: How many restaurants with the highest risk level still passed the inspection?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: List the names of employees involved in an inspection with the Display of Inspection Report Summary category.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: What is the title of the employee involved in inspection ID 60332?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT T1.title FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 60332 |
Write SQL query to solve given problem: How many of the restaurants with the lowest risk level failed the complaint inspection type?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Provide the fine paid and the complete address of the establishment with inspection ID 48216.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: What is the inspection ID of the inspection with critical point level, $500 fine, and inspector comment "CDI ON 5-17-10"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: What are the inspection description and inspector's comments in the inspection ID 164795?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: What are the inspector's comments and clean operating requirement code for inspection ID 54216 and point ID 34?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: Among the establishments that failed in the inspection, what is the percentage of establishments with the highest risk level?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: How many inspections were done in January 2011?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT COUNT(inspection_id) FROM inspection WHERE strftime('%Y-%m', inspection_date) = '2011-01' |
Write SQL query to solve given problem: How many inspections failed in 2014?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT COUNT(inspection_id) FROM inspection WHERE strftime('%Y', inspection_date) = '2014' AND results = 'Fail' |
Write SQL query to solve given problem: Calculate the percentage of inspections with the fine for a minor food safety problem.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT CAST(COUNT(CASE WHEN fine = 100 THEN inspection_id END) AS REAL) * 100 / COUNT(inspection_id) FROM violation |
Write SQL query to solve given problem: List the point IDs and fines of the inspections done on 7th August 2010.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: How many inspections were done under the personnel category?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Provide the names and inspection results of the facilities located in Burnham.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Compare the number of inspections under toxic items and no-smoking regulations.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: Which facilities were inspected by Sarah Lindsey on 20th November 2012?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Provide the categories and fines for the inspections done by Lisa Tillman in January 2014.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT DISTINCT T4.category, T3.fine FROM inspection AS T1 INNER JOIN employee AS T2 ON T1.employee_id = T2.employee_id INNER JOIN violation AS T3 ON T1.inspection_id = T3.inspection_id INNER JOIN inspection_point AS T4 ON T3.point_id = T4.point_id WHERE T2.first_name = 'Lisa' AND T2.last_name = 'Tillman' AND strftime('%Y-%m', T1.inspection_date) = '2014-01' |
Write SQL query to solve given problem: How many inspections were done under the display of inspection report summary category?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: List the types and results of the inspections done on Riverwalk café.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Who inspected Jean Samocki and what was the result?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: How much did Hacienda Los Torres from ward 36 fine for failing an inspection?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Calculate the total amount of fine under the food equipment and utensil category.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Provide the names and locations of the facilities that failed inspections on 29th July 2013.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Calculate the percentage of inspections with verified quality. Among them, how many businesses were from Chicago?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Calculate the average inspections per year done by Jessica Anthony from 2010 to 2017.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT CAST(COUNT(CASE WHEN T1.first_name = 'Jessica' AND T1.last_name = 'Anthony' THEN T2.inspection_id ELSE 0 END) AS REAL) / 8 FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE strftime('%Y', T2.inspection_date) BETWEEN '2010' AND '2017' |
Write SQL query to solve given problem: Provide the first name of employee who did inspection ID 48225?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: Tell the address of employee who did inspection ID 52238?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT T1.address FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 52238 |
Write SQL query to solve given problem: Write down the last name of employee who did inspection ID 52238?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: What is the inspection result for inspection done by Thomas Langley?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: List down the address of employees who did inspection dated 11/5/2010.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: List down the phone numbers of employees who did Canvass inspection.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: What is the job title of employee who did inspection ID 52269?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT T1.title FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id WHERE T2.inspection_id = 52269 |
Write SQL query to solve given problem: What are the inspection results for Xando Coffee & Bar / Cosi Sandwich Bar?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: What type of inspection was done at John Schaller?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: List down the dba name of restaurants that were inspected due to license.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: How many inspections done in 2010 had serious food safety issue?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT COUNT(T2.inspection_id) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T2.inspection_date) = '2010' AND T1.risk_level = 3 |
Write SQL query to solve given problem: State the name of dbas with verified quality.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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%' |
Write SQL query to solve given problem: Calculate the total salary for employees who did inspection from ID 52270 to 52272.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: Calculate the average salary for employees who did inspection on License Re-Inspection.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Did license number 1222441 pass the inspection and what is the zip code number of it?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: When did restaurant John Schaller has its first inspection in 2010?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 = 'JOHN SCHALLER' AND strftime('%Y', T2.inspection_date) = '2010' |
Write SQL query to solve given problem: What is the full name of the employee that inspected establishments with license 1334073?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: Which establishments did Joshua Rosa inspect?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: How many employees have salary greater than 70000 but fail the inspection?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: Name the food businesses that passed the inspection in 2010.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT DISTINCT T1.dba_name FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y', T2.inspection_date) = '2010' AND T2.results = 'Pass' AND T1.facility_type = 'Liquor' |
Write SQL query to solve given problem: What is the name of the establishment that Joshua Rosa inspected?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: How many taverns failed in July 2010?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y-%m', T2.inspection_date) = '2010-07' AND T2.results = 'Fail' AND T1.facility_type = 'Restaurant' |
Write SQL query to solve given problem: What is the risk level of the establishment that Bob Benson inspected?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Which establishments did Bob Benson inspect in 2010 and what was the results?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT DISTINCT T3.dba_name, T2.results 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' AND strftime('%Y', T2.inspection_date) = '2010' |
Write SQL query to solve given problem: What is the title of the employee that inspected the establishment with license number 1576687?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: How many inspection points with serious point level that have no fine?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: What is the percentage of restaurants that paid a fine of 250 among all establishments?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: What is the percentage of establishments with a risk level of 1 among all of the establishments that passed the inspection?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: Where does the employee named "Standard Murray" live?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT address, city, state FROM employee WHERE first_name = 'Standard' AND last_name = 'Murray' |
Write SQL query to solve given problem: What is the facility type of the establishment named "Kinetic Playground"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT facility_type FROM establishment WHERE dba_name = 'Kinetic Playground' |
Write SQL query to solve given problem: How much salary does Jessica Anthony receive?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT salary FROM employee WHERE first_name = 'Jessica' AND last_name = 'Anthony' |
Write SQL query to solve given problem: What is the restaurant's name at "41.9532864854" latitude and "-87.7673790701422" longitude?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT dba_name FROM establishment WHERE latitude = 41.9532864854 AND longitude = -87.7673790701422 AND facility_type = 'Restaurant' |
Write SQL query to solve given problem: Among the list of employees, what is the total number of supervisors?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT COUNT(employee_id) FROM employee WHERE title = 'Supervisor' |
Write SQL query to solve given problem: Where in Chicago does the restaurant named "Old Timers Rest & Lounge" located?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT address FROM establishment WHERE city = 'CHICAGO' AND dba_name = 'OLD TIMERS REST & LOUNGE' AND facility_type = 'Restaurant' |
Write SQL query to solve given problem: How many employees are living in Hoffman Estates, IL?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT COUNT(employee_id) FROM employee WHERE state = 'IL' AND city = 'Hoffman Estates' |
Write SQL query to solve given problem: What is the total number of establishments with the highest risk level?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT COUNT(license_no) FROM establishment WHERE risk_level = 3 |
Write SQL query to solve given problem: Who is the employee that receives 82700 as their salary?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT first_name, last_name FROM employee WHERE salary = 82700 |
Write SQL query to solve given problem: Provide the last name of the employee involved in the inspection ID 52256.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: Please list the names of taverns that paid a $100 fine upon inspection.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: List point level of inspections with no fine.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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 |
Write SQL query to solve given problem: Provide the facility type and license number of establishments with the lowest risk level but failed the inspection.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: What is the result of the February 24, 2010 inspection involving the employee named "Arnold Holder"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: How many restaurants failed the inspection in April 2010?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | SELECT COUNT(DISTINCT T1.license_no) FROM establishment AS T1 INNER JOIN inspection AS T2 ON T1.license_no = T2.license_no WHERE strftime('%Y-%m', T2.inspection_date) = '2010-04' AND T1.facility_type = 'Restaurant' AND T2.results = 'Fail' |
Write SQL query to solve given problem: List all inspection IDs where the employee named "Rosemary Kennedy" was involved.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Write SQL query to solve given problem: What type of inspection was done on July 07, 2010, involving the employee named "Lisa Tillman"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | food_inspection_2 | 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' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.