db_id
stringclasses 68
values | question
stringlengths 33
321
| evidence
stringlengths 0
673
| SQL
stringlengths 116
743
| question_id
int64 3
6.6k
| difficulty
stringclasses 2
values |
---|---|---|---|---|---|
disney | Provide the movie titles and the estimated inflation rate of the highest total grossed movie. | The highest grossed movie refers to MAX(total_gross); DIVIDE(inflation_adjusted_gross, total_gross) as percentage; | SELECT movie_title, CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) / CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL) FROM movies_total_gross ORDER BY CAST(REPLACE(trim(total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1 | 6,223 | challenging |
disney | Name the director of Disney's lowest grossing movie. | lowest grossing movie refers to movie_title where MIN(total_gross); | SELECT T2.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) ASC LIMIT 1 | 2,773 | moderate |
disney | What are the total grosses for the movies with Jim Cummings as the voice actor? | FALSE; | SELECT T2.movie_title FROM `voice-actors` AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie WHERE T1.`voice-actor` = 'Jim Cummings' ORDER BY CAST(REPLACE(trim(T2.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1 | 6,379 | moderate |
disney | Provide the title, total gross, and MPAA rating of the movie which has a hero named Elsa. | Elsa is the main character of the movie which refers to hero = 'Elsa'; title refers to movie_title; | SELECT T1.movie_title, T1.total_gross, T1.MPAA_rating FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title INNER JOIN director AS T3 ON T3.name = T1.movie_title WHERE T2.hero = 'Elsa' | 5,662 | moderate |
disney | Among the movies directed by Wolfgang Reitherman, how many of them were released in December? | Wolfgang Reitherman refers to director = 'Wolfgang Reitherman'; released in December refers to (release_date, instr(release_date, '-') + 1, 3) = 'Dec'; | SELECT COUNT(movie_title) FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE SUBSTR(release_date, INSTR(release_date, '-') + 1, 3) = 'Dec' AND T2.director = 'Wolfgang Reitherman' | 3,368 | moderate |
disney | List all the voice actors in the movie directed by Ben Sharpsteen which was released on February 9, 1940. | Ben Sharpsteen refers to director = 'Ben Sharpsteen'; released on February 9, 1940 refers to release_date = 'Feb 9, 1940'; | SELECT T2.`voice-actor` FROM director AS T1 INNER JOIN `voice-actors` AS T2 INNER JOIN movies_total_gross AS T3 ON T1.name = T2.movie AND T2.movie = T3.movie_title WHERE T1.director = 'Ben Sharpsteen' AND T3.release_date = 'Feb 9, 1940' AND T2.`voice-actor` != 'None' GROUP BY T2.`voice-actor` | 6,000 | challenging |
disney | What is the highest grossing movie without a song? | the highest grossing movie without song refers to movie_title where MAX(total_gross) and song = 'null'; | SELECT T1.movie_title FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T2.movie_title = T1.movie_title WHERE T2.song IS NULL ORDER BY CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) DESC LIMIT 1 | 5,087 | moderate |
disney | Who is the hero character of the adventure movie which was released on 2016/3/4? | released on 2016/3/4 refers to release_date = '4-Mar-16'; adventure movie refers to genre = 'Adventure' ; | SELECT T1.hero FROM characters AS T1 INNER JOIN movies_total_gross AS T2 ON T2.movie_title = T1.movie_title WHERE T2.genre = 'Adventure' AND T1.release_date = '4-Mar-16' | 2,499 | moderate |
disney | Among the movies directed by Wolfgang Reitherman, which one of them was the most popular? | directed by Wolfgang Reitherman refers to director = 'Wolfgang Reitherman'; the most popular movie refers to MAX(total_gross); | SELECT T2.movie_title FROM director AS T1 INNER JOIN movies_total_gross AS T2 ON T1.name = T2.movie_title WHERE T1.director = 'Wolfgang Reitherman' ORDER BY T2.total_gross DESC LIMIT 1 | 1,691 | moderate |
disney | The main character Elsa is voiced by which actor and who is the director of the movie? | Elsa is the main character of the movie which refers to hero = 'Elsa'; voiced by which actor refers to voice-actor; | SELECT T1.`voice-actor`, T3.director FROM `voice-actors` AS T1 INNER JOIN characters AS T2 ON T1.movie = T2.movie_title INNER JOIN director AS T3 ON T2.movie_title = T3.name WHERE T2.hero = 'Elsa' | 3,962 | moderate |
disney | Calculate the percentage of directors whose films grossed over $100 million. | DIVIDE(COUNT(director where total_gross > 100000000), COUNT(director)) as percentage; | SELECT CAST(COUNT(DISTINCT CASE WHEN CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) > 100000000 THEN T3.director ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT T3.director) FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title INNER JOIN director AS T3 ON T1.movie_title = T3.name | 4,528 | challenging |
disney | List the titles of movies directed by Jack Kinney that were released before 1947. | Jack Kinney refers to director = 'Jack Kinney'; released before 1947 refers to substr(release_date, length(release_date) - 1, length(release_date)) < '47'; | SELECT T1.movie_title FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Jack Kinney' AND SUBSTR(T1.release_date, LENGTH(T1.release_date) - 1, LENGTH(T1.release_date)) < '47' | 5,225 | moderate |
disney | What is the difference in the current gross of Cars and its sequel, Cars 2? Which movie is more popular? | SUBTRACT(inflation_adjusted_gross where movie_title = 'Cars', inflation_adjusted_gross where movie_title = 'Cars 2'); more popular movie refers to movie_title where MAX(inflation_adjusted_gross); | SELECT SUM(CASE WHEN movie_title = 'Cars' THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END), SUM(CASE WHEN movie_title = 'Cars 2' THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END) FROM movies_total_gross | 1,020 | challenging |
disney | For the movie in which Tress MacNeille was the voice actor for its character "Hyacinth Hippo", what was the release date of that movie? | FALSE; | SELECT T1.release_date FROM characters AS T1 INNER JOIN `voice-actors` AS T2 ON T2.movie = T1.movie_title WHERE T2.character = 'Hyacinth Hippo' AND T2.`voice-actor` = 'Tress MacNeille' | 1,072 | moderate |
disney | Among the movies released from 2001 to 2005, list down the titles and directors of the movies which had a total gross of more than 100% above the average. | Released from 2001 to 2005 refers to substr(release_date, length(release_date) - 3, length(release_date)) between '2001' and '2005'; DIVIDE(SUM(total_gross), COUNT(movie_title)); | SELECT T2.name, T2.director FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) BETWEEN '2001' AND '2005' AND CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) / ( SELECT SUM(CAST(REPLACE(trim(T3.total_gross, '$'), ',', '') AS REAL)) / COUNT(T3.movie_title) AS avg_gross FROM movies_total_gross AS T3 INNER JOIN director AS T4 ON T3.movie_title = T4.name WHERE SUBSTR(T3.release_date, LENGTH(T3.release_date) - 3, LENGTH(T3.release_date)) BETWEEN '2001' AND '2005' ) - 1 > 1 | 242 | challenging |
disney | What proportion of the total gross of all movies is from movies with songs? | Movies with songs refer song = 'not null'; DIVIDE(SUM(total_gross where song = 'not null'), sum(total_gross)) as percentage; | SELECT CAST(COUNT(CASE WHEN T1.song IS NOT NULL THEN T2.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T2.movie_title) FROM characters AS T1 INNER JOIN movies_total_gross AS T2 ON T1.movie_title = T2.movie_title | 2,903 | moderate |
disney | List the names of the directors whose films grossed over $100 million. | films grossed over $100 million refer to movie_title where total_gross > 100000000; | SELECT DISTINCT T2.director FROM characters AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name INNER JOIN movies_total_gross AS T3 ON T1.movie_title = T3.movie_title WHERE CAST(REPLACE(trim(T3.total_gross, '$'), ',', '') AS REAL) > 100000000 | 5,773 | moderate |
disney | What is the average total gross for the movies featuring Sterling Holloway? | DIVIDE(SUM(total_gross where voice-actor = 'Sterling Holloway'); COUNT(movie_title where voice-actor = 'Sterling Holloway')); | SELECT SUM(CAST(REPLACE(trim(T2.total_gross, '$'), ',', '') AS REAL)) / COUNT(T2.movie_title) FROM `voice-actors` AS T1 INNER JOIN movies_total_gross AS T2 ON T1.movie = T2.movie_title WHERE T1.`voice-actor` = 'Sterling Holloway' | 843 | moderate |
disney | Name the main character of Disney's most popular adventure movie based on its inflation-adjusted gross. | adventure movie refers to genre = 'Adventure'; the main character of the movie refers to hero; most popular movie based on its inflation-adjusted gross refers to where MAX(inflation_adjusted_gross); | SELECT T2.hero FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title WHERE T1.genre = 'Adventure' ORDER BY CAST(REPLACE(trim(T1.inflation_adjusted_gross, '$'), ',', '') AS REAL) DESC LIMIT 1 | 4,380 | moderate |
disney | How many movies for mature audiences or parental guidance suggested did Bill Thompson work as a voice actor? | movies for mature audiences or parental guidance refer to movie_title where MPAA_rating = 'PG'; | SELECT COUNT(T.movie) FROM ( SELECT T1.movie FROM `voice-actors` AS T1 INNER JOIN movies_total_gross AS T2 ON T1.movie = T2.movie_title WHERE MPAA_rating = 'PG' AND `voice-actor` = 'Bill Thompson' GROUP BY T1.movie ) AS T | 5,396 | moderate |
disney | Provide the names of voice actors for the characters of films directed by Wolfgang Reitherman. | Wolfgang Reitherman refers to director = 'Wolfgang Reitherman'; | SELECT T2.hero, T1.`voice-actor` FROM `voice-actors` AS T1 INNER JOIN characters AS T2 ON T1.movie = T2.movie_title INNER JOIN director AS T3 ON T3.name = T2.movie_title WHERE T3.director = 'Wolfgang Reitherman' | 2,262 | moderate |
disney | How many restricted horror movies were released between 1/1/1990 to 12/31/2015? | Restricted refers to MPAA_rating = 'R'; horror refers to genre = 'Horror'; released between 1/1/1990 to 12/31/2015 refers to (cast(SUBSTR(release_date, instr(release_date, ', ') + 1) as int) between 1990 and 2015); | SELECT COUNT(movie_title) FROM movies_total_gross WHERE MPAA_rating = 'R' AND genre = 'Horror' AND CAST(SUBSTR(release_date, INSTR(release_date, ', ') + 1) AS int) BETWEEN 1990 AND 2015 | 5,794 | moderate |
disney | Provide the titles, main characters, and associated songs of the movies directed by Wolfgang Reitherman in 1977. | Wolfgang Reitherman refers to director = 'Wolfgang Reitherman'; 1997 refers to substr(release_date, length(release_date) - 3, length(release_date)) = '1977'; the titles refer to movie_title; main characters refer to hero; | SELECT T1.movie_title, T2.hero, T2.song FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title INNER JOIN director AS T3 ON T1.movie_title = T3.name WHERE T3.director = 'Wolfgang Reitherman' AND SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) = '1977' | 6,222 | challenging |
disney | Provide the directors and MPAA ratings of the musical movies released in 1993. | Musical movies refer to genre = 'Musical'; released in 1993 refers to substr(release_date, length(release_date) - 3, length(release_date)) = '1993'; | SELECT T2.director, T1.MPAA_rating FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T1.genre = 'Musical' AND SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) = '1993' | 1,630 | challenging |
disney | Among the movies released from 1991 to 2000, calculate the percentage of comedy movies. Provide any five movie titles and directors. | DIVIDE(COUNT(movie_title where genre = 'Comedy'), COUNT(movie_title)) as percentage where substr(release_date, length(release_date) - 3, length(release_date)) between '1991' and '2000'; | SELECT CAST(COUNT(CASE WHEN T1.genre = 'Comedy' THEN T1.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_title), group_concat(T1.movie_title), group_concat(T2.director) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE SUBSTR(T1.release_date, LENGTH(T1.release_date) - 3, LENGTH(T1.release_date)) BETWEEN '1991' AND '2000' | 5,724 | challenging |
disney | Wolfgang Reitherman has directed several Disney movies, which one has the highest grossing after accounting for inflation? | Wolfgang Reitherman refers to director = 'Wolfgang Reitherman'; the highest grossing after accounting for inflation refers to MAX(inflation_adjusted_gross); | SELECT T1.movie_title FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Wolfgang Reitherman' ORDER BY CAST(REPLACE(SUBSTR(inflation_adjusted_gross, 2), ',', '') AS REAL) DESC LIMIT 1 | 4,037 | moderate |
disney | What is the most popular movie directed by Ron Clements? | Ron Clements refers to director = 'Ron Clements'; the most popular movie refers to movie_title where MAX(total_gross); | SELECT T2.name FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T2.name = T1.movie_title WHERE T2.director = 'Ron Clements' ORDER BY CAST(REPLACE(SUBSTR(total_gross, 2), ',', '') AS int) DESC LIMIT 1 | 5,766 | moderate |
disney | How many of Gary Trousdale's movies are adventure movies? | Gary Trousdale refers director = 'Gary Trousdale'; the adventure movie refers to genre = 'Adventure'; | SELECT COUNT(T.name) FROM ( SELECT T1.name FROM director AS T1 INNER JOIN movies_total_gross AS T2 ON T1.name = T2.movie_title WHERE T1.director = 'Gary Trousdale' AND T2.genre = 'Adventure' GROUP BY T1.name ) T | 5,947 | moderate |
disney | Calculate the percentage of voice actors whose main character in the movie is in the Drama genre. | DIVIDE(COUNT(voice-actor where genre = 'Drama'), COUNT(voice-actor)) as percentage; | SELECT CAST(COUNT(CASE WHEN T1.genre = 'Drama' THEN T3.`voice-actor` ELSE NULL END) AS REAL) * 100 / COUNT(T3.`voice-actor`) FROM movies_total_gross AS T1 INNER JOIN characters AS T2 ON T1.movie_title = T2.movie_title INNER JOIN `voice-actors` AS T3 ON T3.movie = T1.movie_title | 4,246 | challenging |
disney | Give the name of the director of the movie in which Verna Felton was the voice actor for its character "Aunt Sarah". | FALSE; | SELECT T1.director FROM director AS T1 INNER JOIN `voice-actors` AS T2 ON T2.movie = T1.name WHERE T2.character = 'Aunt Sarah' AND T2.`voice-actor` = 'Verna Felton' | 6,102 | moderate |
donor | Which state have the highest number of PayPal donations for an honoree whose portion of a donation included corporate sponsored giftcard? | which state refers to donor_state; highest number refers to max(count(donor_state)); PayPal donations refers to payment_method = 'paypal'; for an honoree refers to for_honoree = 't'; included corporate sponsored giftcard refers to payment_included_campaign_gift_card = 't' | SELECT DISTINCT donor_state FROM donations WHERE for_honoree = 't' AND payment_included_campaign_gift_card = 't' AND payment_method = 'paypal' AND donor_state = ( SELECT donor_state FROM donations GROUP BY donor_state ORDER BY SUM(donation_total) DESC LIMIT 1 ) | 5,431 | moderate |
donor | Calculate the sum of all the total amount donated to the essay project titled 'Lets Share Ideas' which were paid through paypal and indicate the city and poverty level. | paypal refer to payment method; Lets Share Ideas refer to title; city refer to school_city; total amount donated refer to SUM(donation_total of paypal where payment_method = ’paypal’) | SELECT SUM(T3.donation_total), school_city, poverty_level FROM essays AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid INNER JOIN donations AS T3 ON T2.projectid = T3.projectid WHERE T1.title = 'Lets Share Ideas' AND T3.payment_method = 'paypal' | 6,127 | moderate |
donor | What are the favorite project types of each of the top 10 donors? | favorite project type refers to project_resource_type; top donors refers to max(donation_total) | SELECT project_resource_type FROM ( SELECT T1.donor_acctid, T3.project_resource_type FROM donations AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid INNER JOIN resources AS T3 ON T2.projectid = T3.projectid ORDER BY T1.donation_total DESC LIMIT 10 ) GROUP BY project_resource_type ORDER BY COUNT(project_resource_type) DESC LIMIT 1 | 3,921 | moderate |
donor | What percentage of donations are given via a giving or campaign page? List the primary area of those donations. | given via a giving or campaign page refers to via_giving_page = 't'; percentage refers to DIVIDE(count(case when via_giving_page = 't' then donationid else null end),count(donationid))*100; primary area of donation refers to primary_focus_area | SELECT CAST(SUM(CASE WHEN T1.via_giving_page = 't' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(donation_total), ( SELECT T2.primary_focus_area FROM donations AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T1.via_giving_page = 't' GROUP BY T2.primary_focus_area ORDER BY SUM(T1.donation_total) DESC LIMIT 1 ) result FROM donations AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid | 4,118 | challenging |
donor | What is the essay title of the project that have the highest total price excluding optional support and who is the biggest donor? Identify the donor and calculate how many percent did he/she donated in the project. | highest total price excluding optional support refers to max(total_price_excluding_optional_support); who refers to donor_acctid; percent = divide(donation_to_project, total_price_excluding_optional_support)*100% | SELECT T1.title, T3.donor_acctid, CAST(T3.donation_to_project AS REAL) / T2.total_price_excluding_optional_support FROM essays AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid INNER JOIN donations AS T3 ON T2.projectid = T3.projectid ORDER BY T3.donation_to_project DESC LIMIT 1 | 2,455 | challenging |
donor | What were the resources that were requested by the teacher for project "d6ef27c07c30c81f0c16c32b6acfa2ff"? Indicate the quantities as well and whether or not the teacher acquired P.h.D or doctor degree. | resources that were requested refers to item_name; project "d6ef27c07c30c81f0c16c32b6acfa2ff" refers to projectid = 'd6ef27c07c30c81f0c16c32b6acfa2ff'; quantities refers to item_quantity; teacher_prefix = 'Dr. ' refers to teacher acquired P.h.D or doctor degree | SELECT DISTINCT T1.item_name, T1.item_quantity, T2.teacher_prefix FROM resources AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T1.projectid = 'd6ef27c07c30c81f0c16c32b6acfa2ff' | 1,334 | moderate |
donor | Name the project that costs the most. How much has been collected from donation and what is the percentage amount still lacking? | project name refers to title; costs the most refers to max(total_price_excluding_optional_support); amount collected from donation refers to sum(donation_to_project); percentage amount refers to divide(subtract(total_price_excluding_optional_support, sum(donation_to_project)), sum(donation_to_project))*100% | SELECT T1.title, SUM(T3.donation_to_project), CAST((T2.total_price_excluding_optional_support - SUM(T3.donation_to_project)) AS REAL) * 100 / SUM(T3.donation_to_project) FROM essays AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid INNER JOIN donations AS T3 ON T2.projectid = T3.projectid ORDER BY T2.total_price_excluding_optional_support DESC LIMIT 1 | 3,523 | challenging |
donor | What is the most requested item under the resource type "Supplies" for projects whose main subject area is Literacy & Language? | main subject area refers to primary_focus_area = 'Literacy & Language'; resource type supplies refers to project_resource_type = 'Supplies'; most requested item refers to Max(item_quantity); | SELECT T1.item_name FROM resources AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T2.primary_focus_area = 'Literacy & Language' AND T1.project_resource_type = 'Supplies' ORDER BY T1.item_quantity DESC LIMIT 1 | 2,855 | moderate |
donor | What is the average amount of donations by people who donated in the project "Recording Rockin' Readers" | average amount of donations = divide(sum(donation_to_project), count(donor_acctid)); project "Recording Rockin' Readers" refers to title = 'Recording Rockin' Readers' | SELECT AVG(T3.donation_to_project) FROM essays AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid INNER JOIN donations AS T3 ON T2.projectid = T3.projectid WHERE T1.title = 'Recording Rockin'' Readers' | 3,694 | moderate |
donor | Name the vendors who provide resources for project 'Lights, Camera, Action!'. List all the item names and unit price for each. | project 'Lights, Camera, Action!' refers to title = 'Lights, Camera, Action!' | SELECT T1.vendor_name, T1.item_name, T1.item_unit_price FROM resources AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid INNER JOIN essays AS T3 ON T2.projectid = T3.projectid WHERE T3.title = 'Lights, Camera, Action!' | 2,161 | challenging |
donor | When was the first ever project went live on the site and what were the names of the resources being requested? If there are multiple projects that have the same date, indicate each of them and their items. | first ever project refers to min(date_posted); names of the resources refers to item_name | SELECT T2.date_posted, T1.item_name FROM resources AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T2.date_posted = ( SELECT date_posted FROM projects ORDER BY date_posted ASC LIMIT 1 ) | 2,111 | moderate |
donor | What is the id of the project that has the highest optional tip? Indicate the names of the resources that were requested. | highest optional tip refers to subtract(total_price_including_optional_support, total_price_excluding_optional_support); names of the resources refers to item_name | SELECT T1.projectid, T1.item_name FROM resources AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid ORDER BY T2.total_price_including_optional_support - T2.total_price_excluding_optional_support DESC LIMIT 1 | 6,263 | moderate |
donor | What is the total price of items brought from ABC School Supply with a listed type of Other? Also include the list of the buyers' coordinates and school districts they belong to. | ABC School Supply refer to vendor_name; listed type as Other refer to project_resource_type = 'Other'; coordinates refer to coordinates(school_latitude, school_longitude); total price of items refer to SUM(MULTIPLY(item_unit_price, item_quantity where vendor_name = ’ABC School Supply’))
| SELECT T2.item_unit_price * T2.item_quantity price, T1.school_latitude, T1.school_longitude FROM projects AS T1 INNER JOIN resources AS T2 ON T1.projectid = T2.projectid WHERE T2.vendor_name = 'ABC School Supply' AND T2.project_resource_type = 'Other' AND T1.school_district = 'Hillsborough Co Pub Sch Dist' | 3,747 | moderate |
donor | Write the message of the donor of the project with the title of Lets Share Ideas who paid with a credit card. | message of the donor refer to donation_message; Lets Share Ideas refer to title; paid with a credit card refer to payment_method | SELECT T3.donation_message FROM essays AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid INNER JOIN donations AS T3 ON T2.projectid = T3.projectid WHERE T1.title = 'Lets Share Ideas' AND T3.payment_method = 'creditcard' | 3,457 | moderate |
donor | From which state do the 5 biggest donor, who gave the highest cost of optional support, come from? List their donor_acctid and calculate for their average cost of optional support for every donations they make and identtify the project's type of resource to which they gave the hightest optional support. | which state refers to school_state; highest cost of optional support refers to max(donation_optional_support); average cost of optional support = avg(donation_optional_support) | SELECT T1.school_state, T2.donor_acctid, AVG(T2.donation_optional_support), T1.resource_type FROM projects AS T1 INNER JOIN donations AS T2 ON T1.projectid = T2.projectid ORDER BY T2.donation_optional_support DESC LIMIT 5 | 5,322 | challenging |
donor | How many donations does the project "Look, Look, We Need a Nook!" have? | project "Look, Look, We Need a Nook!" refers to title = 'Look, Look, We Need a Nook!' | SELECT SUM(T3.donation_total) FROM essays AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid INNER JOIN donations AS T3 ON T2.projectid = T3.projectid WHERE T1.title = 'Look, Look, We Need a Nook!' | 2,791 | moderate |
donor | Among the donations with a portion using account credits redemption, how many of them are for projects created by teachers working in a public year-round school? | portion using account credits redemption refers to payment_included_acct_credit = 't'; year-round school refers to school_year_round = 't'; | SELECT COUNT(T1.projectid) FROM projects AS T1 INNER JOIN donations AS T2 ON T1.projectid = T2.projectid WHERE T2.payment_included_acct_credit = 't' AND T1.school_year_round = 't' | 4,343 | moderate |
donor | What is the total amount of all the donations made by the donor who made the highest donation in a single amount? Indicate the essay title to where he/she made his/her biggest donation. | total amount of all the donations refers to sum(donation_total); highest donation refers to max(donation_total) | SELECT T2.donation_total, T1.title FROM essays AS T1 INNER JOIN donations AS T2 ON T1.projectid = T2.projectid WHERE T2.donation_total = ( SELECT MAX(donation_total) FROM donations ) | 1,125 | moderate |
donor | Of the projects whose resources are provided by the vendor Lakeshore Learning Materials, the school of which project has the highest cost of labor fulfillment? Please give its school ID. | Lakeshore Learning Materials is vendor_name; highest cost of labor fulfillment refers to Max(fulfillment_labor_materials); | SELECT T2.schoolid FROM resources AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T1.vendor_name = 'Lakeshore Learning Materials' ORDER BY T2.fulfillment_labor_materials DESC LIMIT 1 | 2,879 | moderate |
donor | Where is the school that needs a "Viewscreen LCD from Texas Instruments, TI-84 Plus"? Provide the latitude and longitude of that school. | needs a "Viewscreen LCD from Texas Instruments, TI-84 Plus" refers to item_name = 'Viewscreen LCD from Texas Instruments, TI-84 Plus'; where is the school refers to school_city; latitude refers to school_latitude; longtitude refers to school_longitude | SELECT T2.school_city, T2.school_latitude, T2.school_longitude FROM resources AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T1.item_name = 'Viewscreen LCD FROM Texas Instruments, TI-84 Plus' | 6,577 | moderate |
donor | Among the technology items, what percentage of them are from Best Buy for Business? Provide the date of the project related to those items. | technology items refers to project_resource_type = 'Technology'; from Best Buy for Business refers to vendor_name = 'Best Buy for Business'; percentage refers to DIVIDE(count(case when vendor_name = 'Best Buy for Business'),count(projectid)) | SELECT CAST(SUM(CASE WHEN T1.vendor_name = 'Best Buy for Business' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.projectid) FROM resources AS T1 INNER JOIN projects AS T2 ON T1.projectid = T2.projectid WHERE T1.project_resource_type = 'Technology' UNION ALL SELECT DISTINCT T1.date_posted FROM projects AS T1 INNER JOIN resources AS T2 ON T1.projectid = T2.projectid WHERE T2.vendor_name = 'Best Buy for Business' AND T2.project_resource_type = 'Technology' | 5,089 | challenging |
donor | What is the total donation amount for the project 'Engaging Young Readers with a Leveled Classroom Library'? | Engaging Young Readers with a Leveled Classroom Library' is the title; total donation amount = Add(donation_to_project, donation_optional_support) | SELECT SUM(T2.donation_to_project) + SUM(T2.donation_optional_support) FROM essays AS T1 INNER JOIN donations AS T2 ON T1.projectid = T2.projectid WHERE T1.title LIKE 'Engaging Young Readers with a Leveled Classroom Library ' | 2,183 | moderate |
donor | What is the short description of the project that gives donation to school “301c9bf0a45d159d162b65a93fddd74e”? | school “301c9bf0a45d159d162b65a93fddd74e" refers to schoolid = '301c9bf0a45d159d162b65a93fddd74e'; | SELECT T2.short_description FROM projects AS T1 INNER JOIN essays AS T2 ON T1.projectid = T2.projectid WHERE T1.schoolid = '301c9bf0a45d159d162b65a93fddd74e' | 3,414 | moderate |
donor | For the all donations to the project 'Bringing Drama to Life', what is the percentage of the donation is paid by credit card? | Bringing Drama to Life' is the title; Percentage = Divide(Count(payment_method = 'creditcard'), Count(projectid))*100; | SELECT CAST(SUM(CASE WHEN T2.payment_method LIKE 'creditcard' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(donationid) FROM essays AS T1 INNER JOIN donations AS T2 ON T1.projectid = T2.projectid WHERE T1.title LIKE 'Bringing Drama to Life' | 4,629 | challenging |
european_football_1 | How many teams playing in divisions in Greece have ever scored 4 or more goals? | teams include both HomeTeam and AwayTeam; country = 'Greece'; scored 4 or more goals refer to FTAG≥4, which is short name for Final-time Away-team Goals; | SELECT COUNT(DISTINCT CASE WHEN T1.FTHG >= 4 THEN HomeTeam ELSE NULL end) + COUNT(DISTINCT CASE WHEN T1.FTAG >= 4 THEN AwayTeam ELSE NULL end) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.country = 'Greece' | 2,105 | moderate |
european_football_1 | What's the home win ratio of the Bundesliga division in 2021? | home win refers to FTR = 'H', where H stands for home victory; season = '2021'; Bundesliga is a name of division; DIVIDE(COUNT(Div where FTR = 'H, season = '2021' and name = 'Bundesliga'), COUNT(Div where season = '2021' and name = 'Bundesliga')) as percentage; | SELECT CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T2.name = 'Bundesliga' | 1,588 | moderate |
european_football_1 | How many matches played in the 2019 season of Scottish Championship league were ended with an equal result of 2-2? | matches refer to Div; Scottish Championship is a name of the league; equal result of 2-2 refers to FTAG = 2 AND FTHG = 2; | SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2019 AND T2.name = 'Scottish Championship' AND T1.FTAG = 2 AND T1.FTHG = 2 | 6,022 | moderate |
european_football_1 | What was the difference in home team and away team win percentages across all divisions in 2010? | 2010 refers to season = 2010; SUBTRACT(DIVIDE(COUNT(Div where FTR = 'H', season = 2010), COUNT(Div where season = 2010)), COUNT(Div where FTR = 'A', season = 2010), COUNT(Div where season = 2010)) as percentage; | SELECT CAST(COUNT(CASE WHEN FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(FTR) - CAST(COUNT(CASE WHEN FTR = 'A' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(FTR) DIFFERENCE FROM matchs WHERE season = 2010 | 1,746 | challenging |
european_football_1 | What percentage of games won, games lost and games drawn does Cittadella have as a home team in total? | Percentage of games won = DIVIDE(COUNT(FTR = 'H' where HomeTeam = 'Cittadella'), COUNT(Div where HomeTeam = 'Cittadella')) as percentage; Percentage of games lost = DIVIDE(COUNT(FTR = 'A' where HomeTeam = 'Cittadella')), COUNT(Div where HomeTeam = 'Cittadella') as percentage; percentage of games drawn = DIVIDE(SUM(FTR = 'D'where HomeTeam = 'Cittadella'), COUNT(Div where HomeTeam = 'Cittadella')) as percentage;
| SELECT CAST(COUNT(CASE WHEN FTR = 'H' THEN 1 ELSE NULL END) / COUNT(HomeTeam) AS REAL) * 100, CAST(COUNT(CASE WHEN FTR = 'A' THEN 1 ELSE NULL END) AS REAL) / COUNT(HomeTeam), CAST(COUNT(CASE WHEN FTR = 'D' THEN 1 ELSE NULL END) AS REAL) / COUNT(HomeTeam) FROM matchs WHERE HomeTeam = 'Cittadella' | 4,136 | challenging |
european_football_1 | For all the games ended up with 1-1, what percentage of them are from Liga NOS division? | 1-1 is a score where FTHG = '1' and FTAG = '1'; Liga NOS is the name of division; DIVIDE(COUNT(Div where FTHG = '1', FTAG = '1', name = 'Liga NOS'), COUNT(Div where FTHG = '1' and FTAG = '1')) as percentage; | SELECT CAST(COUNT(CASE WHEN T2.name = 'Liga NOS' THEN T1.Div ELSE NULL END) AS REAL) * 100 / COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.FTHG = 1 AND FTAG = 1 | 333 | moderate |
european_football_1 | From the Spanish LaLiga division in the 2017 season, which team won the most times as a local team and by what percentage? | local team refers to HomeTeam; Spanish means belong to the country = 'Spain'; LaLiga is a name of division; won as a local team refers to FTR = 'H', where H stands for home victory; DIVIDE(COUNT(Div where name = 'LaLiga', country = 'Spain', season = 2017, FRT = 'H'), COUNT(Div where name = 'LaLiga', country = 'Spain', season = 2017)) as percentage; | SELECT T1.HomeTeam HWHT , CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(HomeTeam) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'LaLiga' AND T2.country = 'Spain' AND T1.season = 2017 | 2,951 | moderate |
european_football_1 | How many teams that played in the 2012 season belong to any of the English divisions and what percentage play in each of the divisions? | matches = Div | SELECT ( SELECT COUNT(T1.Div) AS total FROM matchs T1 INNER JOIN divisions T2 ON T2.division = T1.Div WHERE T2.country = 'England' AND T1.season = 2012 ) AS num , CASE WHEN 1 THEN T.result END AS percentage FROM ( SELECT 100.0 * COUNT(T1.Div) / ( SELECT COUNT(T1.Div) FROM matchs T1 INNER JOIN divisions T2 ON T2.division = T1.Div WHERE T2.country = 'England' AND T1.season = 2012 ) AS result FROM matchs T1 INNER JOIN divisions T2 ON T2.division = T1.Div WHERE T2.country = 'England' AND T1.season = 2012 GROUP BY T2.division ) AS T | 1,767 | challenging |
european_football_1 | How many home victories does the Bundesliga division have in more or less than the Premier League division in the 2021 season? | Bundesliga and the Premier League are names of division; home victories refer to FTR = 'H', where H stands for home victory; SUBTRACT(COUNT(FTR = 'H' where season = 2021, name = 'Bundesliga'), COUNT(FTR = 'H' where season = 2021, name = 'Premier League')); | SELECT COUNT(CASE WHEN T2.name = 'Bundesliga' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T2.name = 'Premier League' THEN 1 ELSE NULL END) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.FTR = 'H' | 4,815 | moderate |
european_football_1 | For the Ligue 2 game that made the most goals, who is the winner of that game? | Ligue 2 is the name of division; the most goals refer to MAX(SUM(FTHG, FTAG)) which are short names for Final-time Home-team Goals and Final-time Away-team Goals; winner refers to FTR = 'A'; | SELECT CASE WHEN T1.FTR = 'H' THEN T1.HomeTeam ELSE T1.AwayTeam END WINNER FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Ligue 2' ORDER BY T1.FTAG + T1.FTHG DESC LIMIT 1 | 2,120 | moderate |
european_football_1 | How many times did the team Werder Bremen win as the away team in matches of the Bundesliga division? | Bundesliga is the name of division; win as the away team refers to FTR = 'A', where 'A' stands for away victory; | SELECT COUNT(T1.Div) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Bundesliga' AND T1.AwayTeam = 'Werder Bremen' AND T1.FTR = 'A' | 691 | moderate |
european_football_1 | What is the name of the division in which Club Brugge and Genk competed on September 13, 2009? | September 13, 2009 refers to Date = '2009-09-13'; Club Brugge refers to HomeTeam; Genk refers to AwayTeam; | SELECT T2.name FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.Date = '2009-09-13' and T1.HomeTeam = 'Club Brugge' AND T1.AwayTeam = 'Genk' | 3,905 | moderate |
european_football_1 | In which division was the match between Hibernian, the away team, and Hearts, the home team, played? To which country does this division belong? | FALSE; | SELECT DISTINCT T2.division,T2.country FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.HomeTeam = 'Hearts' AND T1.AwayTeam = 'Hibernian' | 2,892 | moderate |
european_football_1 | How many Scottish League One games took place on the day that "Pro Vercelli" and "Pescara"had a 5-2 game? | Pro Vercelli and Pescara are names of teams; HomeTeam = 'Pro Vercelli'; AwayTeam = 'Pescara'; 5-2 is a score where FTHG = '5' and FTAG = '2'; Scottish League One is a name of division; games refer to Div; | SELECT COUNT(T1.Date) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T2.name = 'Scottish League One' AND T1.Date = ( SELECT Date FROM matchs WHERE FTHG = 5 AND FTAG = 2 AND HomeTeam = 'Pro Vercelli' AND AwayTeam = 'Pescara' ) | 5,428 | moderate |
european_football_1 | Which team had more home victories in the 2021 season's matches of the Bundesliga division, Augsburg or Mainz? | Bundesliga is the name of division; more home victories refer to MAX(FTR = 'H)'; Augsburg and Mainz are names of teams and refer to HomeTeam; | SELECT CASE WHEN COUNT(CASE WHEN T1.HomeTeam = 'Augsburg' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T1.HomeTeam = ' Mainz' THEN 1 ELSE NULL END) > 0 THEN 'Augsburg' ELSE 'Mainz' END FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.FTR = 'H' | 1,965 | challenging |
european_football_1 | What's the winning rate of Club Brugge in the 2021 Premier League? | Premier League is name of division; season = 2021; Club Brugge is name of team; Club Brugge wins implies HomeTeam = 'Club Brugge' and FTR = 'H' and AwayTeam = 'Club Brugge' and FTR = 'A'; DIVIDE(SUM(COUNT(FTR = 'H' where HomeTeam = 'Club Brugge', name = 'Premier League', season = 2021), COUNT(FTR = 'A'where AwayTeam = 'Club Brugge', name = 'Premier League', season = 2021)), COUNT(Div where name = 'Premier League', season = 2021)); | SELECT CAST(COUNT(CASE WHEN T1.FTR = 'H' THEN 1 ELSE NULL END) + COUNT(CASE WHEN T1.FTR = 'A' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(t1.FTR) FROM matchs AS T1 INNER JOIN divisions AS T2 ON T1.Div = T2.division WHERE T1.season = 2021 AND T1.AwayTeam = 'Club Brugge' OR T1.HomeTeam = 'Club Brugge' | 5,453 | challenging |
food_inspection | Which restaurant had more low risk violation in inspections, Tiramisu Kitchen or OMNI S.F. Hotel - 2nd Floor Pantry? | Tiramisu Kitchen and OMNI S.F. Hotel - 2nd Floor Pantry are names of the business; more low risk violations refer to MAX(COUNT(risk_category = 'Low Risk')); | SELECT CASE WHEN SUM(CASE WHEN T2.name = 'OMNI S.F. Hotel - 2nd Floor Pantry' THEN 1 ELSE 0 END) > SUM(CASE WHEN T2.name = 'Tiramisu Kitchen' THEN 1 ELSE 0 END) THEN 'OMNI S.F. Hotel - 2nd Floor Pantry' ELSE 'Tiramisu Kitchen' END AS result FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'Low Risk' | 6,472 | challenging |
food_inspection | In businesses with a score lower than 95 and located around the postal code of 94110, what is the percentage of businesses with a risk category of low risk? | DIVIDE(COUNT(business_id where risk_category = 'Low Risk', score < 95 and postal_code = 94110), COUNT(business_id where score < 95 and postal_code = 94110)) as percentage; | SELECT CAST(SUM(CASE WHEN T1.risk_category = 'Low Risk' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.risk_category) FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN businesses AS T3 ON T2.business_id = T3.business_id WHERE T2.score < 95 AND T3.postal_code = 94110 | 2,941 | moderate |
food_inspection | Among the restaurants being inspected in 2016, how many of them are in San Francisco? | inspected in 2016 refers to YEAR(date) = 2016; San Francisco refers to city in ('San Francisco', 'SF' ,'S.F.', 'SAN FRANCISCO'); | SELECT COUNT(DISTINCT T2.business_id) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2016' AND T2.city IN ('San Francisco', 'SAN FRANCISCO', 'SF', 'S.F.') | 1,104 | moderate |
food_inspection | What is the description of the low risk violation of Tiramisu Kitchen on 2014/1/14? | Tiramisu Kitchen is the name of the business; 2014/1/14 refers to date = '2014-01-14'; low risk violations refer to risk_category = 'Low Risk'; | SELECT T1.description FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = '2014-01-14' AND T2.name = 'Tiramisu Kitchen' AND T1.risk_category = 'Low Risk' | 559 | moderate |
food_inspection | In businesses that violates 103157 on May 27, 2016 , what is the name of the business that has an unscheduled inspection? | businesses that violates 103157 refer to business_id where violation_type_id = 103157; date = '2016-05-27'; unscheduled inspection refers to type = 'Routine - Unscheduled'; | SELECT DISTINCT T3.name FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN businesses AS T3 ON T2.business_id = T3.business_id WHERE T1.`date` = '2016-05-27' AND T1.violation_type_id = 103157 AND T2.type = 'Routine - Unscheduled' | 3,643 | moderate |
food_inspection | Who is the owner of the business that has a high risk violation of 103109 and described as unclean or unsanitary food contact surfaces? | owner refers to owner_name; high risk violation of 103109 and described as unclean or unsanitary food contact surfaces refers to risk_category = 'High Risk' where violation_type_id = 103109 and description = 'Unclean or unsanitary food contact surfaces'; | SELECT DISTINCT T2.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.risk_category = 'High Risk' AND T1.violation_type_id = 103109 AND T1.description = 'Unclean or unsanitary food contact surfaces' | 774 | moderate |
food_inspection | List the business' name and risk category of businesses with a score greater than the 80% of average score of all businesses. | score greater than the 80% of average score of all businesses refers to score > MULTIPLY(0.8, avg(score) from inspections); | SELECT DISTINCT T1.name, T3.risk_category FROM businesses AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN violations AS T3 ON T1.business_id = T3.business_id WHERE T2.score > 0.8 * ( SELECT AVG(score) FROM inspections ) | 3,702 | moderate |
food_inspection | Which business was the first one to get a low risk violation because of "Permit license or inspection report not posted"? Give the name of the business. | low risk violation because of "Permit license or inspection report not posted" refers to risk_category = 'Low Risk' where description = 'Permit license or inspection report not posted'; business was the first one refers to name where MIN(date); | SELECT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = ( SELECT MIN(`date`) FROM violations WHERE risk_category = 'Low Risk' AND description = 'Permit license or inspection report not posted' ) AND T1.risk_category = 'Low Risk' AND T1.description = 'Permit license or inspection report not posted' | 2,669 | challenging |
food_inspection | Among the top 5 owners with highest number of establishments, which owner has the highest number of high risk violations? Give the name of the owner. | 5 owners with highest number of establishments refer to owner_name where MAX(COUNT(business_id)) LIMIT 5; the highest number of high risk violations refers to MAX(COUNT(risk_category = 'High Risk')); | SELECT T4.owner_name FROM violations AS T3 INNER JOIN businesses AS T4 ON T3.business_id = T4.business_id INNER JOIN ( SELECT T2.owner_name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id GROUP BY T2.owner_name ORDER BY COUNT(T1.business_id) DESC LIMIT 5 ) AS T5 ON T4.owner_name = T5.owner_name WHERE T3.risk_category = 'High Risk' GROUP BY T4.owner_name ORDER BY COUNT(T3.risk_category) DESC LIMIT 1 | 4,057 | challenging |
food_inspection | What is the name of the establishment with the highest number of low risk violations in 2014? | establishment with the highest number of low risk violations refers to business_id where MAX(COUNT(risk_category = 'Low Risk')); year(date) = 2014; | SELECT T2.name FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE STRFTIME('%Y', T1.`date`) = '2014' AND T1.risk_category = 'Low Risk' GROUP BY T2.name ORDER BY COUNT(T2.business_id) DESC LIMIT 1 | 4,038 | moderate |
food_inspection | What is the average score for "Chairman Bao" in all its unscheduled routine inspections? | DIVIDE(SUM(score where type = 'Routine - Unscheduled' and name = 'Chairman Bao'), COUNT(type = 'Routine - Unscheduled' where name = 'Chairman Bao')); | SELECT CAST(SUM(CASE WHEN T2.name = 'Chairman Bao' THEN T1.score ELSE 0 END) AS REAL) / COUNT(CASE WHEN T1.type = 'Routine - Unscheduled' THEN T1.score ELSE 0 END) FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id | 6,425 | moderate |
food_inspection | Among the businesses within the postal code 94117, what is total number of businesses with a high risk category? | businesses with a high risk category refer to business_id where risk_category = 'High Risk'; | SELECT COUNT(DISTINCT T2.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.postal_code = 94117 AND T1.risk_category = 'High Risk' | 6,145 | moderate |
food_inspection | Describe the inspection types and violation descriptions under moderate risk category for ART's CAFÉ. | ART's CAFÉ is the name of the business; moderate risk category refers to risk_category = 'Moderate Risk'; | SELECT DISTINCT T2.type, T1.description FROM violations AS T1 INNER JOIN inspections AS T2 ON T1.business_id = T2.business_id INNER JOIN businesses AS T3 ON T2.business_id = T3.business_id WHERE T3.name = 'ART''S CAFÉ' AND T1.risk_category = 'Moderate Risk' | 2,190 | moderate |
food_inspection | What percentage of the violations for "Melody Lounge" are moderate risks? | DIVIDE(COUNT(risk_category = 'Moderate Risk' where name = 'Melody Lounge'), COUNT(business_id where name = 'Melody Lounge')) as percentage; | SELECT CAST(SUM(CASE WHEN T2.risk_category = 'Moderate Risk' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.business_id) FROM businesses AS T1 INNER JOIN violations AS T2 ON T1.business_id = T2.business_id WHERE T1.name = 'Melody Lounge' | 271 | moderate |
food_inspection | Which business had the lowest score for the unscheduled routine inspection on 2016/9/26? Give the name of the business. | the lowest score for unscheduled routine inspection refers to type = 'Routine - Unscheduled' where MIN(score); date = '2016-09-26'; | SELECT T2.name FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE score = ( SELECT MIN(score) FROM inspections WHERE `date` = '2016-09-26' AND type = 'Routine - Unscheduled' ) AND T1.`date` = '2016-09-26' AND T1.type = 'Routine - Unscheduled' | 4,959 | challenging |
food_inspection | Give the description of the moderate risk violation which "Chez Fayala, Inc." had on 2016/7/1. | "Chez Fayala, Inc." is the name of the business; moderate risk violation refers to risk_category = 'Moderate Risk'; date = '2016-07-01'; | SELECT T1.description FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.name = 'Chez Fayala, Inc.' AND T1.`date` = '2016-07-01' AND T1.risk_category = 'Moderate Risk' | 3,699 | moderate |
food_inspection | In businesses with an owner address 500 California St, 2nd Floor of Silicon Valley, list the type of inspection of the business with the highest score. | the highest score MAX(score); Silicon Valley is located in 'SAN FRANCISCO'; | SELECT T1.type FROM inspections AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T2.owner_address = '500 California St, 2nd Floor' AND T2.owner_city = 'SAN FRANCISCO' ORDER BY T1.score DESC LIMIT 1 | 5,858 | moderate |
food_inspection | How many low risk violations were found in the inspection on 2014/1/14 for Tiramisu Kitchen? | Tiramisu Kitchen is the name of the business; inspection on 2014/1/14 refers to date = '2014-01-14'; low risk violations refer to risk_category = 'Low Risk'; | SELECT COUNT(T1.business_id) FROM violations AS T1 INNER JOIN businesses AS T2 ON T1.business_id = T2.business_id WHERE T1.`date` = '2014-01-14' AND T2.name = 'Tiramisu Kitchen' AND T1.risk_category = 'Low Risk' | 1,814 | moderate |
food_inspection_2 | 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. | 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) | SELECT 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 strftime('%Y-%m', T2.inspection_date) = '2010-02' AND T1.salary > 0.7 * ( SELECT AVG(salary) FROM employee ) | 472 | moderate |
food_inspection_2 | What are the names of the businesses that passed with conditions in May 2012? | name of business refers to dba_name; passed with conditions refers to results = 'Pass w/ Conditions'; in May 2012 refers to inspection_date like '2012-05%' | 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' | 1,427 | moderate |
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' | 4,552 | moderate |
food_inspection_2 | Name the taverns that failed the inspection in January 2010. | tavern refers to facility_type = 'Tavern'; failed the inspection refers to results = 'Fail'; in January 2010 refers to inspection_date like '2010-01%' | 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 strftime('%Y-%m', T2.inspection_date) = '2010-01' AND T2.results = 'Fail' AND T1.facility_type = 'TAVERN' | 2,109 | moderate |
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' | 4,735 | moderate |
food_inspection_2 | What is the average number of inspections carried out in the year 2010 by a sanitarian whose salary is over 70000? | in the year 2010 refers to inspection_date like '2010%'; salary is over 70000 refers to salary > 70000; average number = divide(sum(inspection where inspection_date like '2010%'), sum(employee_id where salary > 70000)) | SELECT CAST(SUM(CASE WHEN T2.inspection_date LIKE '2010%' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.salary > 70000 THEN 1 ELSE 0 END) FROM employee AS T1 INNER JOIN inspection AS T2 ON T1.employee_id = T2.employee_id | 6,110 | moderate |
food_inspection_2 | Among the establishments that paid a 500 fine, what is the percentage of restaurants? | 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 | SELECT CAST(COUNT(CASE WHEN T1.facility_type = 'Restaurant' THEN T1.license_no END) AS REAL) * 100 / COUNT(T1.facility_type) 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 T3.fine = 500 | 6,183 | moderate |
food_inspection_2 | How much is the total fine given to Ron of Japan Inc in its inspection done on February 2014? | total fine = sum(fine); Ron of Japan Inc refers to dba_name = 'RON OF JAPAN INC'; on February 2014 refers to inspection_date like '2014-02%' | 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' | 3,186 | moderate |
food_inspection_2 | Please list the full names of the sanitarians who did at least one inspection in May, 2010. | full name refers to first_name, last_name; in May 2010 refers to inspection_date like '2010-05%'; sanitarian refers to title = 'Sanitarian' | 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 strftime('%Y-%m', T2.inspection_date) = '2010-05' AND T1.title = 'Sanitarian' | 772 | moderate |
food_inspection_2 | Provide the categories and fines for the inspections done by Lisa Tillman in January 2014. | in January 2014 refers to inspection_date like '2014-01%' | 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' | 4,948 | moderate |
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 | 378 | challenging |
food_inspection_2 | Which establishments did Bob Benson inspect in 2010 and what was the results? | establishment name refers to dba_name; in 2010 refers to inspection_date like '2010%' | 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' | 1,005 | moderate |
Subsets and Splits