Chinastark/bird_dataset huggingface dataset:
Database: food_inspection_2
Note: 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%;
Question: Which business had the highest number of inspections done? Calculate the percentage of passed and failed inspections of the said business.
SQL: SELECT establishment.dba_name , cast(sum(CASE WHEN inspection.results = 'Pass' THEN 1 ELSE 0 END) AS REAL) * 100 / count(inspection.inspection_id) AS percentagepassed , cast(sum(CASE WHEN inspection.results = 'Fail' THEN 1 ELSE 0 END) AS REAL) * 100 / count(inspection.inspection_id) FROM inspection INNER JOIN establishment ON inspection.license_no = establishment.license_no GROUP BY establishment.dba_name ORDER BY count(inspection.license_no) DESC LIMIT 1
Database: food_inspection_2
Note: 7211 S Hermitage Ave refers to address = '7211 S Hermitage Ave'; Chicago refers to city = 'Chicago'; IL refers to state = 'IL';
Question: What is the employee's last name at 7211 S Hermitage Ave, Chicago, IL?
SQL: SELECT last_name FROM employee WHERE address = '7211 S Hermitage Ave' AND city = 'Chicago' AND state = 'IL'
Database: food_inspection_2
Note: 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';
Question: What is the establishment's name and employee involved in the inspection ID 44256 on May 5, 2010?
SQL: SELECT establishment.dba_name, employee.first_name, employee.last_name FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no INNER JOIN employee ON inspection.employee_id = employee.employee_id WHERE inspection.inspection_date = '2010-05-05' AND inspection.inspection_id = 44256
Database: food_inspection_2
Note: school refers to facility_type = 'School'; pass refers to results = 'Pass'; in March 2010 refers to inspection_date like '2010-03%';
Question: Give the address of the schools that passed the inspection in March 2010.
SQL: SELECT DISTINCT establishment.address FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE strftime('%Y-%m', inspection.inspection_date) = '2010-03' AND inspection.results = 'Pass' AND establishment.facility_type = 'School'
Database: food_inspection_2
Note: 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';
Question: What is the employee's full name involved in the canvass inspection type on March 09, 2010?
SQL: SELECT DISTINCT employee.first_name, employee.last_name FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.inspection_date = '2010-03-09' AND inspection.inspection_type = 'Canvass'
Database: food_inspection_2
Note: "PIZZA RUSTICA, INC." refers to dba_name = 'PIZZA RUSTICA, INC';
Question: Provide the inspection ID of the establishment named "PIZZA RUSTICA, INC."
SQL: SELECT DISTINCT inspection.inspection_id FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE establishment.dba_name = 'PIZZA RUSTICA, INC'
Database: food_inspection_2
Note: restaurant refers to facility_type = 'Restaurant'; the highest risk level refers to max(risk_level); pass the inspection refers to results = 'Pass';
Question: How many restaurants with the highest risk level still passed the inspection?
SQL: SELECT count(DISTINCT establishment.license_no) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE establishment.risk_level = 3 AND inspection.results = 'Pass' AND establishment.facility_type = 'Restaurant'
Database: food_inspection_2
Note: name refers to first_name, last_name; Display of inspection Report Summary category refers to category = 'Display of inspection Report Summary';
Question: List the names of employees involved in an inspection with the Display of Inspection Report Summary category.
SQL: SELECT DISTINCT employee.first_name, employee.last_name FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id INNER JOIN violation ON inspection.inspection_id = violation.inspection_id INNER JOIN inspection_point ON violation.point_id = inspection_point.point_id WHERE inspection_point.category = 'Display of Inspection Report Summary'
Database: food_inspection_2
Question: What is the title of the employee involved in inspection ID 60332?
SQL: SELECT employee.title FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.inspection_id = 60332
Database: food_inspection_2
Note: 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';
Question: How many of the restaurants with the lowest risk level failed the complaint inspection type?
SQL: SELECT count(DISTINCT establishment.license_no) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE establishment.risk_level = '1' AND inspection.inspection_type = 'Complaint' AND establishment.facility_type = 'Restaurant' AND inspection.results = 'Fail'
Database: food_inspection_2
Note: complete address refers to state, city, address;
Question: Provide the fine paid and the complete address of the establishment with inspection ID 48216.
SQL: SELECT DISTINCT violation.fine, establishment.state, establishment.city, establishment.address FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no INNER JOIN violation ON inspection.inspection_id = violation.inspection_id WHERE inspection.inspection_id = 48216
Database: food_inspection_2
Note: 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';
Question: What is the inspection ID of the inspection with critical point level, $500 fine, and inspector comment "CDI ON 5-17-10"?
SQL: SELECT violation.inspection_id FROM inspection_point INNER JOIN violation ON inspection_point.point_id = violation.point_id WHERE violation.fine = 500 AND inspection_point.point_level = 'Critical' AND violation.inspector_comment = 'CDI ON 5-17-10'
Database: food_inspection_2
Note: inspection description refers to description; inspector's comment refers to inspector_comment;
Question: What are the inspection description and inspector's comments in the inspection ID 164795?
SQL: SELECT inspection_point.description, violation.inspector_comment FROM inspection_point INNER JOIN violation ON inspection_point.point_id = violation.point_id WHERE violation.inspection_id = 44247
Database: food_inspection_2
Note: inspector's comment refers to inspector_comment; clean operating requirement code refers to code;
Question: What are the inspector's comments and clean operating requirement code for inspection ID 54216 and point ID 34?
SQL: SELECT violation.inspector_comment, inspection_point.code FROM inspection_point INNER JOIN violation ON inspection_point.point_id = violation.point_id WHERE violation.inspection_id = 54216 AND violation.point_id = 34
Database: food_inspection_2
Note: 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';
Question: Among the establishments that failed in the inspection, what is the percentage of establishments with the highest risk level?
SQL: SELECT cast(count(CASE WHEN establishment.risk_level = 3 THEN establishment.license_no END) AS REAL) * 100 / count(establishment.risk_level) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE inspection.results = 'Fail'
Database: food_inspection_2
Note: 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;
Question: 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?
SQL: SELECT sum(CASE WHEN violation.fine = 100 THEN 1 ELSE 0 END) - sum(CASE WHEN violation.fine = 500 THEN 1 ELSE 0 END) FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id INNER JOIN violation ON inspection.inspection_id = violation.inspection_id WHERE employee.salary BETWEEN 75000 AND 80000
Database: food_inspection_2
Note: in January 2011 refers to inspection_date like '2011-01%';
Question: How many inspections were done in January 2011?
SQL: SELECT count(inspection_id) FROM inspection WHERE strftime('%Y-%m', inspection_date) = '2011-01'
Database: food_inspection_2
Note: failed refers to results = 'Fail'; in 2014 refers to inspection_date like '2014%';
Question: How many inspections failed in 2014?
SQL: SELECT count(inspection_id) FROM inspection WHERE strftime('%Y', inspection_date) = '2014' AND results = 'Fail'
Database: food_inspection_2
Note: fine for a minor food safety problem refers to fine = 100; percentage = divide(count(inspection_id where fine = 100), sum(inspection_id)) * 100%;
Question: Calculate the percentage of inspections with the fine for a minor food safety problem.
SQL: SELECT cast(count(CASE WHEN fine = 100 THEN inspection_id END) AS REAL) * 100 / count(inspection_id) FROM violation
Database: food_inspection_2
Note: on 7th August 2010 refers to inspection_date = '2010-08-07';
Question: List the point IDs and fines of the inspections done on 7th August 2010.
SQL: SELECT violation.point_id, violation.fine FROM inspection INNER JOIN violation ON inspection.inspection_id = violation.inspection_id WHERE inspection.inspection_date = '2010-08-07'
Database: food_inspection_2
Note: under the personnel category refers to category = 'Personnel';
Question: How many inspections were done under the personnel category?
SQL: SELECT count(violation.inspection_id) FROM violation INNER JOIN inspection_point ON violation.point_id = inspection_point.point_id WHERE inspection_point.category = 'Personnel'
Database: food_inspection_2
Note: names refers to dba_name; inspection result refers to results; in Burnham refers to city = 'BURNHAM';
Question: Provide the names and inspection results of the facilities located in Burnham.
SQL: SELECT DISTINCT establishment.dba_name, inspection.results FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE establishment.city = 'BURNHAM'
Database: food_inspection_2
Note: under toxic items refers to category = 'Toxic Items'; no-smoking regulations refers to category = 'No Smoking Regulations';
Question: Compare the number of inspections under toxic items and no-smoking regulations.
SQL: SELECT count(CASE WHEN inspection_point.category = 'Toxic Items' THEN violation.inspection_id END) AS tox_nums , count(CASE WHEN inspection_point.category = 'No Smoking Regulations' THEN violation.inspection_id END) AS nosmonums FROM violation INNER JOIN inspection_point ON violation.point_id = inspection_point.point_id
Database: food_inspection_2
Note: facility name refers to dba_name; on 20th November 2012 refers to inspection_date = '2012-11-20';
Question: Which facilities were inspected by Sarah Lindsey on 20th November 2012?
SQL: SELECT DISTINCT establishment.dba_name FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no INNER JOIN employee ON inspection.employee_id = employee.employee_id WHERE inspection.inspection_date = '2012-11-20' AND employee.first_name = 'Sarah' AND employee.last_name = 'Lindsey'
Database: food_inspection_2
Note: in January 2014 refers to inspection_date like '2014-01%';
Question: Provide the categories and fines for the inspections done by Lisa Tillman in January 2014.
SQL: SELECT DISTINCT inspection_point.category, violation.fine FROM inspection INNER JOIN employee ON inspection.employee_id = employee.employee_id INNER JOIN violation ON inspection.inspection_id = violation.inspection_id INNER JOIN inspection_point ON violation.point_id = inspection_point.point_id WHERE employee.first_name = 'Lisa' AND employee.last_name = 'Tillman' AND strftime('%Y-%m', inspection.inspection_date) = '2014-01'
Database: food_inspection_2
Note: under the display of inspection report summary category refers to category = 'Display of inspection Report Summary';
Question: How many inspections were done under the display of inspection report summary category?
SQL: SELECT count(violation.inspection_id) FROM inspection_point INNER JOIN violation ON inspection_point.point_id = violation.point_id WHERE inspection_point.category = 'Display of Inspection Report Summary'
Database: food_inspection_2
Note: type refers to inspection_type; Riverwalk café refers to facility_type = 'RIVERWALK CAFE';
Question: List the types and results of the inspections done on Riverwalk café.
SQL: SELECT inspection.inspection_type, inspection.results FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE establishment.facility_type = 'RIVERWALK CAFE'
Database: food_inspection_2
Note: employee's name refers to first_name, last_name; Jean Samocki refers to dba_name = 'JEAN SAMOCKI';
Question: Who inspected Jean Samocki and what was the result?
SQL: SELECT employee.first_name, employee.last_name, inspection.results FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no INNER JOIN employee ON inspection.employee_id = employee.employee_id WHERE establishment.dba_name = 'JEAN SAMOCKI'
Database: food_inspection_2
Note: Hacienda Los Torres refers to dba_name = 'HACIENDA LOS TORRES'; ward 36 refers to ward = 36; failing an inspection refers to results = 'Fail';
Question: How much did Hacienda Los Torres from ward 36 fine for failing an inspection?
SQL: SELECT sum(violation.fine) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no INNER JOIN violation ON inspection.inspection_id = violation.inspection_id WHERE establishment.dba_name = 'HACIENDA LOS TORRES' AND establishment.ward = 36 AND inspection.results = 'Fail'
Database: food_inspection_2
Note: under the food equipment and utensil category refers to category = 'Food Equipment and Utensil';
Question: Calculate the total amount of fine under the food equipment and utensil category.
SQL: SELECT sum(violation.fine) FROM inspection_point INNER JOIN violation ON inspection_point.point_id = violation.point_id WHERE inspection_point.category = 'Food Equipment and Utensil'
Database: food_inspection_2
Note: 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';
Question: Provide the names and locations of the facilities that failed inspections on 29th July 2013.
SQL: SELECT establishment.dba_name, establishment.longitude, establishment.latitude FROM inspection INNER JOIN establishment ON inspection.license_no = establishment.license_no WHERE inspection.inspection_date = '2013-07-29' AND inspection.results = 'Fail'
Database: food_inspection_2
Note: 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%;
Question: Calculate the percentage of inspections with verified quality. Among them, how many businesses were from Chicago?
SQL: SELECT cast(count(CASE WHEN inspection.results LIKE '%Pass%' THEN inspection.inspection_id END) AS REAL) * 100 / count(inspection.inspection_id), count(DISTINCT inspection.license_no) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE establishment.city = 'CHICAGO'
Database: food_inspection_2
Note: from 2010 to 2017 refers to inspection_date > '2010-01-01' AND T2.inspection_id < '2017-12-31'; average inspections per year = divide(count(inspection_id where inspection_date > '2010-01-01' AND T2.inspection_id < '2017-12-31'), 8);
Question: Calculate the average inspections per year done by Jessica Anthony from 2010 to 2017.
SQL: SELECT cast(count(CASE WHEN employee.first_name = 'Jessica' AND employee.last_name = 'Anthony' THEN inspection.inspection_id ELSE 0 END) AS REAL) / 8 FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE strftime('%Y', inspection.inspection_date) BETWEEN '2010' AND '2017'
Database: food_inspection_2
Question: Provide the first name of employee who did inspection ID 48225?
SQL: SELECT employee.first_name FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.inspection_id = 48225
Database: food_inspection_2
Question: Tell the address of employee who did inspection ID 52238?
SQL: SELECT employee.address FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.inspection_id = 52238
Database: food_inspection_2
Question: Write down the last name of employee who did inspection ID 52238?
SQL: SELECT employee.last_name FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.inspection_id = 52238
Database: food_inspection_2
Note: inspection result refers to results;
Question: What is the inspection result for inspection done by Thomas Langley?
SQL: SELECT DISTINCT inspection.results FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE employee.first_name = 'Thomas' AND employee.last_name = 'Langley'
Database: food_inspection_2
Note: dated 11/5/2010 refers to inspection_date = '2010-11-05';
Question: List down the address of employees who did inspection dated 11/5/2010.
SQL: SELECT DISTINCT employee.address FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.inspection_date = '2010-11-05'
Database: food_inspection_2
Note: phone number refers to phone; Canvass inspection refers to inspection_type = 'Canvass';
Question: List down the phone numbers of employees who did Canvass inspection.
SQL: SELECT DISTINCT employee.phone FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.inspection_type = 'Canvass'
Database: food_inspection_2
Note: job title refers to title;
Question: What is the job title of employee who did inspection ID 52269?
SQL: SELECT employee.title FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.inspection_id = 52269
Database: food_inspection_2
Note: Xando Coffee & Bar / Cosi Sandwich Bar refers to dba_name = 'XANDO COFFEE & BAR / COSI SANDWICH BAR';
Question: What are the inspection results for Xando Coffee & Bar / Cosi Sandwich Bar?
SQL: SELECT DISTINCT inspection.results FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE establishment.dba_name = 'XANDO COFFEE & BAR / COSI SANDWICH BAR'
Database: food_inspection_2
Note: type of inspection refers to inspection_type; John Schaller refers to dba_name = 'JOHN SCHALLER';
Question: What type of inspection was done at John Schaller?
SQL: SELECT DISTINCT inspection.inspection_type FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE establishment.dba_name = 'JOHN SCHALLER'
Database: food_inspection_2
Note: inspected due to license refers to inspection_type = 'License';
Question: List down the dba name of restaurants that were inspected due to license.
SQL: SELECT establishment.dba_name FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE inspection.inspection_type = 'License'
Database: food_inspection_2
Note: in 2010 refers to inspection_date like '2010%'; had serious food safety issue refers to risk_level = 3;
Question: How many inspections done in 2010 had serious food safety issue?
SQL: SELECT count(inspection.inspection_id) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE strftime('%Y', inspection.inspection_date) = '2010' AND establishment.risk_level = 3
Database: food_inspection_2
Note: name of dba refers to dba_name; with verified quality refers to results = 'Pass' or results = 'Pass w/Conditions';
Question: State the name of dbas with verified quality.
SQL: SELECT DISTINCT establishment.dba_name FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE inspection.results LIKE '%Pass%'
Database: food_inspection_2
Note: inspection from ID 52270 to 52272 refers to inspection_id between 52270 and 52272;
Question: Calculate the total salary for employees who did inspection from ID 52270 to 52272.
SQL: SELECT sum(employee.salary) FROM inspection INNER JOIN employee ON inspection.employee_id = employee.employee_id WHERE inspection.inspection_id BETWEEN 52270 AND 52272
Database: food_inspection_2
Note: inspection on License Re-inspection refers to inspection_type = 'License Re-inspection'; average salary = avg(salary);
Question: Calculate the average salary for employees who did inspection on License Re-Inspection.
SQL: SELECT avg(employee.salary) FROM inspection INNER JOIN employee ON inspection.employee_id = employee.employee_id WHERE inspection.inspection_type = 'License Re-Inspection'
Database: food_inspection_2
Note: license number 1222441 refers to license_no = 1222441; result of the inspection refers to results; zip code number refers to zip;
Question: Did license number 1222441 pass the inspection and what is the zip code number of it?
SQL: SELECT DISTINCT inspection.results, establishment.zip FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE establishment.license_no = 1222441
Database: food_inspection_2
Note: John Schaller refers to dba_name = 'JOHN SCHALLER'; first inspection refers to min(inspection_date); in 2010 refers to inspection_date like '2010%';
Question: When did restaurant John Schaller has its first inspection in 2010?
SQL: SELECT min(inspection.inspection_date) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE establishment.dba_name = 'JOHN SCHALLER' AND strftime('%Y', inspection.inspection_date) = '2010'
Database: food_inspection_2
Note: full name refers to first_name, last_name; with license 1334073 refers to license_no = 1334073;
Question: What is the full name of the employee that inspected establishments with license 1334073?
SQL: SELECT DISTINCT employee.first_name, employee.last_name FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.license_no = 1334073
Database: food_inspection_2
Note: establishment name refers to dba_name;
Question: Which establishments did Joshua Rosa inspect?
SQL: SELECT DISTINCT establishment.dba_name FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id INNER JOIN establishment ON inspection.license_no = establishment.license_no WHERE employee.first_name = 'Joshua' AND employee.last_name = 'Rosa'
Database: food_inspection_2
Note: salary greater than 70000 refers to salary > 70000; fail the inspection refers to results = 'Fail';
Question: How many employees have salary greater than 70000 but fail the inspection?
SQL: SELECT count(DISTINCT employee.employee_id) FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.results = 'Fail' AND employee.salary > 70000