Chinastark/bird_dataset huggingface dataset:
Database: food_inspection_2
Note: business name refers to dba_name; food business refers to restaurant; pass the inspection refers to results = 'Pass'; in 2010 refers to inspection_date like '2010%';
Question: Name the food businesses that passed the inspection in 2010.
SQL: SELECT DISTINCT establishment.dba_name FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE strftime('%Y', inspection.inspection_date) = '2010' AND inspection.results = 'Pass' AND establishment.facility_type = 'Liquor'
Database: food_inspection_2
Note: name of the establishment refers to dba_name;
Question: What is the name of the establishment that Joshua Rosa inspected?
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: tavern refers to facility_type = 'Tavern'; failed refers to results = 'Fail'; in July 2010 refers to inspection_date like '2010-07%';
Question: How many taverns failed in July 2010?
SQL: SELECT count(DISTINCT establishment.license_no) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE strftime('%Y-%m', inspection.inspection_date) = '2010-07' AND inspection.results = 'Fail' AND establishment.facility_type = 'Restaurant'
Database: food_inspection_2
Question: What is the risk level of the establishment that Bob Benson inspected?
SQL: SELECT DISTINCT establishment.risk_level 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 = 'Bob' AND employee.last_name = 'Benson'
Database: food_inspection_2
Note: establishment name refers to dba_name; in 2010 refers to inspection_date like '2010%';
Question: Which establishments did Bob Benson inspect in 2010 and what was the results?
SQL: SELECT DISTINCT establishment.dba_name, inspection.results 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 = 'Bob' AND employee.last_name = 'Benson' AND strftime('%Y', inspection.inspection_date) = '2010'
Database: food_inspection_2
Note: license number 1576687 refers to license_no = 1576687;
Question: What is the title of the employee that inspected the establishment with license number 1576687?
SQL: SELECT DISTINCT employee.title FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.license_no = 1576687
Database: food_inspection_2
Note: serious point level refers to point_level = 'Serious '; have no fine refers to fine = 0;
Question: How many inspection points with serious point level that have no fine?
SQL: SELECT count(DISTINCT violation.point_id) FROM inspection_point INNER JOIN violation ON inspection_point.point_id = violation.point_id WHERE inspection_point.point_level = 'Serious ' AND violation.fine = 0
Database: food_inspection_2
Note: a fine of 250 refers to fine = 250; percentage = divide(sum(license_no where fine = 250), count(license_no)) * 100%;
Question: What is the percentage of restaurants that paid a fine of 250 among all establishments?
SQL: SELECT cast(count(CASE WHEN violation.fine = 250 THEN establishment.license_no END) AS REAL) * 100 / count(establishment.license_no) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no INNER JOIN violation ON inspection.inspection_id = violation.inspection_id WHERE establishment.facility_type = 'Restaurant'
Database: food_inspection_2
Note: 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';
Question: What is the percentage of establishments with a risk level of 1 among all of the establishments that passed the inspection?
SQL: SELECT cast(count(CASE WHEN establishment.risk_level = 1 THEN establishment.license_no END) AS REAL) * 100 / count(establishment.license_no) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE inspection.results = 'Pass'
Database: food_inspection_2
Note: address refers to address, city, state;
Question: Where does the employee named "Standard Murray" live?
SQL: SELECT address, city, state FROM employee WHERE first_name = 'Standard' AND last_name = 'Murray'
Database: food_inspection_2
Note: the establishment named "Kinetic Playground" refers to dba_name = 'Kinetic Playground';
Question: What is the facility type of the establishment named "Kinetic Playground"?
SQL: SELECT facility_type FROM establishment WHERE dba_name = 'Kinetic Playground'
Database: food_inspection_2
Question: How much salary does Jessica Anthony receive?
SQL: SELECT salary FROM employee WHERE first_name = 'Jessica' AND last_name = 'Anthony'
Database: food_inspection_2
Note: restaurant refers to facility_type = 'Restaurant'; name refers to dba_name; "41.9532864854" latitude and "-87.7673790701422" longitude refers to latitude = 41.9532864854 and longitude = -87.7673790701422;
Question: What is the restaurant's name at "41.9532864854" latitude and "-87.7673790701422" longitude?
SQL: SELECT dba_name FROM establishment WHERE latitude = 41.9532864854 AND longitude = -87.7673790701422 AND facility_type = 'Restaurant'
Database: food_inspection_2
Note: supervisor refers to title = 'supervisor';
Question: Among the list of employees, what is the total number of supervisors?
SQL: SELECT count(employee_id) FROM employee WHERE title = 'Supervisor'
Database: food_inspection_2
Note: 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;
Question: Where in Chicago does the restaurant named "Old Timers Rest & Lounge" located?
SQL: SELECT address FROM establishment WHERE city = 'CHICAGO' AND dba_name = 'OLD TIMERS REST & LOUNGE' AND facility_type = 'Restaurant'
Database: food_inspection_2
Note: in Hoffman Estates refers to city = 'Hoffman Estates'; IL refers to state = 'IL';
Question: How many employees are living in Hoffman Estates, IL?
SQL: SELECT count(employee_id) FROM employee WHERE state = 'IL' AND city = 'Hoffman Estates'
Database: food_inspection_2
Note: total number of establishments with the highest risk level = count(max(risk_level));
Question: What is the total number of establishments with the highest risk level?
SQL: SELECT count(license_no) FROM establishment WHERE risk_level = 3
Database: food_inspection_2
Note: employee name refers to first_name, last_name; receives 82700 as salary refers to salary = 82700;
Question: Who is the employee that receives 82700 as their salary?
SQL: SELECT first_name, last_name FROM employee WHERE salary = 82700
Database: food_inspection_2
Question: Provide the last name of the employee involved in the inspection ID 52256.
SQL: SELECT DISTINCT employee.last_name FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.inspection_id = 52256
Database: food_inspection_2
Note: name refers to dba_name; tavern refers to facility_type = 'Tavern'; a $100 fine refers to fine = 100;
Question: Please list the names of taverns that paid a $100 fine upon inspection.
SQL: SELECT DISTINCT establishment.dba_name FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no INNER JOIN violation ON inspection.inspection_id = violation.inspection_id WHERE establishment.facility_type = 'Tavern' AND violation.fine = 100
Database: food_inspection_2
Note: no fine refers to fine = 0;
Question: List point level of inspections with no fine.
SQL: SELECT DISTINCT inspection_point.point_level FROM inspection_point INNER JOIN violation ON inspection_point.point_id = violation.point_id WHERE violation.fine = 0
Database: food_inspection_2
Note: license number refers to license_no; the lowest risk level refers to min(risk_level); failed the inspection refers to results = 'Fail';
Question: Provide the facility type and license number of establishments with the lowest risk level but failed the inspection.
SQL: SELECT DISTINCT establishment.facility_type, establishment.license_no FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE establishment.risk_level = 1 AND inspection.results = 'Fail'
Database: food_inspection_2
Note: February 24, 2010 refers to inspection_date = '2010-02-24';
Question: What is the result of the February 24, 2010 inspection involving the employee named "Arnold Holder"?
SQL: SELECT DISTINCT inspection.results FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.inspection_date = '2010-02-24' AND employee.first_name = 'Arnold' AND employee.last_name = 'Holder'
Database: food_inspection_2
Note: restaurant refers to facility_type = 'Restaurant'; failed the inspection refers to results = 'Fail'; in April 2010 refers to inspection_date like '2010-04%';
Question: How many restaurants failed the inspection in April 2010?
SQL: SELECT count(DISTINCT establishment.license_no) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE strftime('%Y-%m', inspection.inspection_date) = '2010-04' AND establishment.facility_type = 'Restaurant' AND inspection.results = 'Fail'
Database: food_inspection_2
Question: List all inspection IDs where the employee named "Rosemary Kennedy" was involved.
SQL: SELECT DISTINCT inspection.inspection_id FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE employee.first_name = 'Rosemary' AND employee.last_name = 'Kennedy'
Database: food_inspection_2
Note: type of inspection refers to inspection_type; on July 07, 2010 refers to inspection_date = '2010-07-07';
Question: What type of inspection was done on July 07, 2010, involving the employee named "Lisa Tillman"?
SQL: SELECT DISTINCT inspection.inspection_type FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE employee.first_name = 'Lisa' AND employee.last_name = 'Tillman' AND inspection.inspection_date = '2010-07-07'
Database: food_inspection_2
Note: 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)';
Question: 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).
SQL: SELECT violation.inspection_id FROM inspection_point INNER JOIN violation ON inspection_point.point_id = violation.point_id WHERE violation.inspector_comment = 'MUST CLEAN AND BETTER ORGANIZE HALLWAY AREA' AND inspection_point.code = '7-38-030, 015, 010 (A), 005 (A)'
Database: food_inspection_2
Note: name of establishment refers to dba_name; the highest risk level refers to max(risk_level); failed the inspection refers to results = 'Fail';
Question: List down the names of the establishments with the highest risk level and failed the inspection.
SQL: SELECT DISTINCT establishment.dba_name FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE establishment.risk_level = 3 AND inspection.results = 'Fail'
Database: food_inspection_2
Note: the "Kamayan Express" establishment refers to dba_name = 'KAMAYAN EXPRESS';
Question: What is the inspection ID where the employee named "David Hodges" is currently employed in the "Kamayan Express" establishment?
SQL: SELECT inspection.inspection_id FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no INNER JOIN employee ON inspection.employee_id = employee.employee_id WHERE employee.first_name = 'David' AND employee.last_name = 'Hodges' AND establishment.dba_name = 'KAMAYAN EXPRESS'
Database: food_inspection_2
Question: Provide the salary range of the employee involved in the inspection ID 58424.
SQL: SELECT employee.salary, employee.salary FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id INNER JOIN employee WHERE inspection.inspection_id = 58424 ORDER BY employee.salary, employee.salary DESC LIMIT 1
Database: food_inspection_2
Note: 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';
Question: 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.
SQL: SELECT violation.inspection_id FROM inspection_point INNER JOIN violation ON inspection_point.point_id = violation.point_id WHERE inspection_point.category = 'Personnel' AND violation.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.'
Database: food_inspection_2
Note: grocery store refers to facility_type = 'Grocery Store'; $250 fine refers to fine = 250;
Question: How many grocery stores paid $250 fine upon their inspection?
SQL: SELECT count(DISTINCT establishment.license_no) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no INNER JOIN violation ON inspection.inspection_id = violation.inspection_id WHERE establishment.facility_type = 'Grocery Store' AND violation.fine = 250
Database: food_inspection_2
Note: the establishment named "J & J FOOD" refers to dba_name = 'J & J FOOD';
Question: What is the category of the inspection of the establishment named "J & J FOOD"?
SQL: SELECT DISTINCT inspection_point.category FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no INNER JOIN violation ON inspection.inspection_id = violation.inspection_id INNER JOIN inspection_point ON violation.point_id = inspection_point.point_id WHERE establishment.dba_name = 'J & J FOOD'
Database: food_inspection_2
Note: tavern refers to facility_type = 'Tavern'; failed the inspection refers to results = 'Fail'; in January 2010 refers to inspection_date like '2010-01%';
Question: Name the taverns that failed the inspection in January 2010.
SQL: SELECT DISTINCT establishment.dba_name FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no INNER JOIN violation ON inspection.inspection_id = violation.inspection_id WHERE strftime('%Y-%m', inspection.inspection_date) = '2010-01' AND inspection.results = 'Fail' AND establishment.facility_type = 'TAVERN'
Database: food_inspection_2
Note: serious point level refers to point_level = 'Serious'; no fines refers to fine = 0;
Question: How many of the inspections with serious point levels have no fines?
SQL: SELECT count(DISTINCT violation.inspection_id) FROM inspection_point INNER JOIN violation ON inspection_point.point_id = violation.point_id WHERE inspection_point.point_level = 'Serious ' AND violation.fine = 0
Database: food_inspection_2
Note: establishment's name refers to dba_name; an inspection category of No Smoking Regulations refers to category = 'No Smoking Regulations';
Question: What is the establishment's name with an inspection category of No Smoking Regulations?
SQL: SELECT DISTINCT establishment.dba_name FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no 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 = 'No Smoking Regulations'
Database: food_inspection_2
Note: 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'));
Question: What is the difference in the number of restaurants that passed and failed the canvass inspection type?
SQL: SELECT count(CASE WHEN inspection.results = 'Pass' THEN establishment.license_no END) - count(CASE WHEN inspection.results = 'Fail' THEN establishment.license_no END) AS diff FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no WHERE inspection.inspection_type = 'Canvass' AND establishment.facility_type = 'Restaurant'
Database: food_inspection_2
Note: failed the inspection refers to results = 'Fail'; in January 2010 refers to inspection_date like '2010-01%'; name of employee refers to first_name, last_name; a salary greater than 70% of the average salary refers to salary > multiply(avg(salary), 0.7);
Question: Among the establishments that failed the inspection in February 2010, list the names of the employees with a salary greater than 70% of the average salary of all employees.
SQL: SELECT DISTINCT employee.employee_id FROM employee INNER JOIN inspection ON employee.employee_id = inspection.employee_id WHERE inspection.results = 'Fail' AND strftime('%Y-%m', inspection.inspection_date) = '2010-02' AND employee.salary > 0.7 * ( SELECT avg(salary) FROM employee )
Database: food_inspection_2
Note: a 500 fine refers to fine = 500; restaurant refers to facility_type = 'Restaurant'; percentage = divide(count(license_no where facility_type = 'Restaurant'), count(license_no)) * 100% where fine = 500;
Question: Among the establishments that paid a 500 fine, what is the percentage of restaurants?
SQL: SELECT cast(count(CASE WHEN establishment.facility_type = 'Restaurant' THEN establishment.license_no END) AS REAL) * 100 / count(establishment.facility_type) FROM establishment INNER JOIN inspection ON establishment.license_no = inspection.license_no INNER JOIN violation ON inspection.inspection_id = violation.inspection_id WHERE violation.fine = 500
Database: coinmarketcap
Note: highest market capitalization refers to max(market_cap); in 2018 refers to year(date) = 2018;
Question: Name the coin that has the highest market capitalization for all transactions in 2018.
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.date LIKE '2018%' AND historical.market_cap = ( SELECT max(market_cap) FROM historical WHERE strftime('%Y', date) = '2018' )
Database: coinmarketcap
Note: total value in the past 24 hours refers to volume_24h; on 11/10/16 refers to date = '2016-11-10';
Question: What is the total value of Argentum coined traded in the past 24 hours on 2016/10/11.
SQL: SELECT historical.volume_24h FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'Argentum' AND historical.date = '2016-10-11'
Database: coinmarketcap
Note: on 1/11/13 and the next 7 consecutive days refers to date BETWEEN '2013-11-01' AND '2013-11-07'; average price refers to AVG(price); Zetacoin refers to name = 'Zetacoin';
Question: List the price for Zetacoin on 13/11/1 and the next 7 consecutive days. What is the average price for these 7 days?
SQL: SELECT historical.price FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'Zetacoin' AND historical.date BETWEEN '2013-11-01' AND '2013-11-07' UNION ALL SELECT avg(historical.price) FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'Zetacoin' AND historical.date BETWEEN '2013-11-01' AND '2013-11-07'
Database: coinmarketcap
Note: in May 2013 refers to month(date) = 5 AND year(date) = 2013; time to achieve the highest price refers to time_high; time to achieve the lowest price refers to time_low; WRAP refers to name = 'WARP';
Question: For all transactions for WRAP in August 2016, list the time to achieve highest price and the time to achieve the lowest price.
SQL: SELECT historical.time_high, historical.time_low, historical.date FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'WARP' AND strftime('%Y-%m', historical.date) = '2016-08'
Database: coinmarketcap
Note: the highest price refers to max(price); DigixDAO refers to name = 'DigixDAO';
Question: State the transaction date whereby DigixDAO was transacted at the hightest price.
SQL: SELECT historical.date FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'DigixDAO' ORDER BY historical.price DESC LIMIT 1
Database: coinmarketcap
Note: the highest percentage price changed in 24 hours refers to max(percent_change_24h);
Question: Name the coin with the highest percentage price changed in 24 hours. State the transaction date and price.
SQL: SELECT coins.name, historical.date, historical.price FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.percent_change_24h = ( SELECT max(percent_change_24h) FROM historical )
Database: coinmarketcap
Note: average monthly circulating supply = AVG(circulating_supply); in 2017 refers to date BETWEEN '2017-01-01' AND '2017-12-31';
Question: What is the average monthly circulating supply for Frozen in 2014.
SQL: SELECT cast(sum(historical.circulating_supply) AS REAL) / 12 FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'Frozen' AND strftime('%Y', historical.date) = '2014'
Database: coinmarketcap
Note: the last date refers to max(date); inactive coins refers to status = 'inactive';
Question: List all the inactive coins and state the last date of its transaction?
SQL: SELECT coins.name, max(historical.date) FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.status = 'inactive' ORDER BY historical.date DESC LIMIT 1
Database: coinmarketcap
Note: 2016 refers to historical date where year(date) = 2016;
Question: What was the price of 1 Bitcoin in 2016?
SQL: SELECT avg(historical.price) FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'Bitcoin' AND strftime('%Y', historical.date) = '2016'
Database: coinmarketcap
Note: was bottomed refers to min(price);
Question: State the transaction date and the price when Bitcoin was bottomed?
SQL: SELECT historical.date, historical.price FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.name = 'Bitcoin' ORDER BY historical.price LIMIT 1
Database: coinmarketcap
Note: average price more than $1000 refers to AVG(price)>1000;
Question: For all coins with average price more than $1000. State the current status of the coin.
SQL: SELECT coins.status FROM coins INNER JOIN historical ON coins.id = historical.coin_id GROUP BY coins.name HAVING avg(historical.price) > 1000
Database: coinmarketcap
Note: the greatest decline in percent change in 1 hour refers to max(percent_change_1h);
Question: Name the coin and date of transactions with the greatest decline in percent change in 1 hour.
SQL: SELECT coins.name, historical.date FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE historical.percent_change_1h = ( SELECT min(percent_change_1h) FROM historical )
Database: coinmarketcap
Note: the highest max profit refers to max(subtract(high, low));
Question: Name the coin under the token category that gives the highest max profit.
SQL: SELECT coins.name FROM coins INNER JOIN historical ON coins.id = historical.coin_id WHERE coins.category = 'token' ORDER BY historical.high - historical.low DESC LIMIT 1