Chinastark/bird_dataset huggingface dataset:
Database: college_completion
Note: between 2011 to 2013 refers to year BETWEEN '2011' AND '2013'; male refers to gender = 'M'; Hispanic refers to race = 'H'; number of degree-seeking students at 2-year institutions who graduated within 150 percent of normal/expected time refers to grad_150; United Education Institute-Huntington Park Campus refers to chronname = 'United Education Institute-Huntington Park Campus';
Question: Between 2011 to 2013, what is the average number of male Hispanic degree-seeking students at 2-year institutions who graduated within 150 percent of normal/expected time in United Education Institute-Huntington Park Campus?
SQL: SELECT avg(institution_grads.grad_150) FROM institution_details INNER JOIN institution_grads ON institution_grads.unitid = institution_details.unitid WHERE institution_details.chronname = 'United Education Institute-Huntington Park Campus' AND institution_grads.year BETWEEN 2011 AND 2013 AND institution_grads.gender = 'M' AND institution_grads.race = 'H'
Database: college_completion
Note: name of the school refers to chronname; highest difference in the average completion rate for the national in which it belongs = MAX(SUBTRACT(awards_per_value, awards_per_natl_value)); state appropriations to higher education in fiscal year 2011 per resident to which the school belongs refers to state_appr_value;
Question: What is the name of the school with the highest difference in the average completion rate for the national in which it belongs? Indicate the state appropriations to higher education in fiscal year 2011 per resident to which the school belongs.
SQL: SELECT institution_details.chronname, state_sector_details.state_appr_value FROM institution_details INNER JOIN state_sector_details ON state_sector_details.state = institution_details.state ORDER BY institution_details.awards_per_value - state_sector_details.awards_per_natl_value DESC LIMIT 1
Database: public_review_platform
Note: AZ refers to state = 'AZ'; stars < 3;
Question: How many Yelp businesses are there in 'AZ' with less than "3" stars?
SQL: SELECT count(business_id) FROM business WHERE state LIKE 'AZ' AND stars < 3
Database: public_review_platform
Note: closed or not running refers to active = 'False'; AZ refers to state = 'AZ';
Question: What is the quantity of the closed or not running Yelp Businesses in 'AZ'?
SQL: SELECT count(business_id) FROM business WHERE state LIKE 'AZ' AND active LIKE 'False'
Database: public_review_platform
Note: long reviews refers to review_length = 'long'; user No. refers to user_id;
Question: How many long reviews does user No. 36139 give for the Yelp businesses?
SQL: SELECT count(review_length) FROM reviews WHERE user_id = 36139 AND review_length LIKE 'long'
Database: public_review_platform
Note: uber number of fans refers to user_fans = 'uber';
Question: How many users have "uber" number of fans?
SQL: SELECT count(user_id) FROM users WHERE user_fans LIKE 'Uber'
Database: public_review_platform
Note: open 24 hours refers to attribute_name = 'Open 24 Hours' AND attribute_value = 'true';
Question: How many Yelp businesses are opened 24 hours?
SQL: SELECT count(business_attributes.business_id) FROM attributes INNER JOIN business_attributes ON attributes.attribute_id = business_attributes.attribute_id WHERE attributes.attribute_name LIKE 'Open 24 Hours' AND business_attributes.attribute_value LIKE 'TRUE'
Database: public_review_platform
Note: kind of wi-fi refers to attribute_value where attribute_name = 'Wi-Fi'; business No. refers to business_id;
Question: What kind of "wi-fi" does Yelp business No."10172" have?
SQL: SELECT business_attributes.attribute_value FROM attributes INNER JOIN business_attributes ON attributes.attribute_id = business_attributes.attribute_id WHERE business_attributes.business_id = 10172 AND attributes.attribute_name LIKE 'wi-fi'
Database: public_review_platform
Note: bars refers to category_name = 'Bars';
Question: How many "bars" are there in the Yelp business?
SQL: SELECT count(categories.category_id) FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id WHERE categories.category_name LIKE 'Bars'
Database: public_review_platform
Note: buffets refers to category_name = 'Buffets'; gyms refers to category_name = 'Gyms'; difference = SUBTRACT(SUM(category_name = 'Buffets'), SUM(category_name = 'Gyms'));
Question: How many more "buffets" than "gyms" in Yelp business?
SQL: SELECT sum(CASE WHEN categories.category_name LIKE 'Buffets' THEN 1 ELSE 0 END) - sum(CASE WHEN categories.category_name LIKE 'Gyms' THEN 1 ELSE 0 END) FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id
Database: public_review_platform
Note: business category refers to category_name; most 5 star reviews refers to MAX(COUNT(category_name WHERE star_reviews = 5));
Question: What business category is the Yelp business which got the most 5 star reviews in?
SQL: SELECT categories.category_name FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id INNER JOIN business ON business_categories.business_id = business.business_id INNER JOIN reviews ON business.business_id = reviews.business_id WHERE reviews.review_stars = 5 GROUP BY categories.category_name ORDER BY count(categories.category_name) DESC LIMIT 1
Database: public_review_platform
Note: year the user join the Yelp refers to user_yelping_since_year; star reviews refers to review_stars;
Question: In which year did the user who gave the most number of "5" star reviews join the Yelp?
SQL: SELECT users.user_yelping_since_year FROM reviews INNER JOIN users ON reviews.user_id = users.user_id WHERE reviews.review_stars = 5 GROUP BY users.user_yelping_since_year ORDER BY count(reviews.review_stars) DESC LIMIT 1
Database: public_review_platform
Note: long reviews refers to review_length = 'long'; most number of long reviews refers to MAX(COUNT(review_length = 'long')); average ratings = AVG(review_stars);
Question: For the user who gave the most number of long reviews, what is his/her averge ratings of all review?
SQL: SELECT cast(sum(reviews.review_stars) AS REAL) / count(reviews.review_stars) FROM reviews INNER JOIN users ON reviews.user_id = users.user_id WHERE reviews.review_length LIKE 'Long' GROUP BY reviews.user_id ORDER BY count(reviews.review_length) DESC LIMIT 1
Database: public_review_platform
Note: long reviews refers to review_length = 'long'; most number of long reviews refers to MAX(COUNT(review_length = 'long')); category refers to category_name;
Question: For the Yelp business which had the most number of "long" reviews, which category does it belong to?
SQL: SELECT categories.category_name FROM reviews INNER JOIN business ON reviews.business_id = business.business_id INNER JOIN business_categories ON business.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id WHERE reviews.review_length LIKE 'Long' GROUP BY business.business_id ORDER BY count(reviews.review_length) DESC LIMIT 1
Database: public_review_platform
Note: short tips refers to tip_length = 'short'; most number of short tips refers to MAX(COUNT(tip_length = 'short')); category refers to category_name;
Question: For the Yelp business which had the most number of "short" tips, which category does it belong to?
SQL: SELECT DISTINCT categories.category_name FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id INNER JOIN business ON business_categories.business_id = business.business_id INNER JOIN tips ON business.business_id = tips.business_id WHERE tips.tip_length LIKE 'short'
Database: public_review_platform
Note: year the user join the Yelp refers to user_yelping_since_year; most number of short tips refers to MAX(COUNT(tip_length = 'Short'));
Question: In which year did the user who has given the most number of "short" tips join the Yelp?
SQL: SELECT users.user_yelping_since_year FROM tips INNER JOIN users ON tips.user_id = users.user_id WHERE tips.tip_length LIKE 'short' GROUP BY users.user_yelping_since_year ORDER BY count(tips.tip_length) DESC LIMIT 1
Database: public_review_platform
Note: user No. refers to user_id; short tip refers to tip_length = 'short'; category refers to category_name;
Question: User No. 70271 only has given one tip to the Yelp business, which category was that business belonged to?
SQL: SELECT categories.category_name FROM tips INNER JOIN business ON tips.business_id = business.business_id INNER JOIN business_categories ON business.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id WHERE tips.user_id = 70271
Database: public_review_platform
Note: short tip refers to tip_lenghth = 'short'; user No. refers to user_id; ratings refers to stars; stars = 5 means great experience; stars = 4 means good experience; stars = 3 means average experience; stars = 2 means bad experience; stars = 1 means terrible experience;
Question: There was only one tip that user No. 69722 gave to the Yelp business, what was the ratings of that business?
SQL: SELECT business.stars FROM tips INNER JOIN business ON tips.business_id = business.business_id WHERE tips.user_id = 69722
Database: public_review_platform
Note: automotive businesses refers to category_name = 'Automotive'; percentage = MULTIPLY(DIVIDE(SUM(category_name = 'Automotive'), COUNT(business_id)), 1.0);
Question: Give the percentage of "Automotive" businesses among all the Yelp businesses.
SQL: SELECT cast(sum(CASE WHEN categories.category_name LIKE 'Automotive' THEN 1 ELSE 0 END) AS REAL) * 100 / count(business_categories.business_id) AS "percentage" FROM business_categories INNER JOIN categories ON business_categories.category_id = categories.category_id
Database: public_review_platform
Note: Women's clothing refers to category_name = 'Women''s Clothing'; Men's clothing refers to category_name = 'Men''s Clothing'; percentage more = MULTIPLY(DIVIDE(SUBTRACT(SUM(category_name = 'Women''s Clothing'), SUM(category_name = 'Men''s Clothing')), COUNT(business_id)), 1.0);
Question: What percentage more for the "Women's Clothing" Yelp businesses to "Men's Clothing"?
SQL: SELECT cast(sum(CASE WHEN categories.category_name LIKE 'Women''s Clothing' THEN 1 ELSE 0 END) AS REAL) * 100 / count(business_categories.business_id) - cast(sum(CASE WHEN categories.category_name LIKE 'Men''s Clothing' THEN 1 ELSE 0 END) AS REAL) * 100 / count(business_categories.business_id) AS "more percentage" FROM business_categories INNER JOIN categories ON business_categories.category_id = categories.category_id
Database: public_review_platform
Note: joined yelp since 2004 refers to user_yelping_since_year = 2004;
Question: Give the number of users who joined Yelp since "2004".
SQL: SELECT count(user_id) FROM users WHERE user_yelping_since_year = 2004
Database: public_review_platform
Note: joined Yelp since 2005 refers to user_yelping_since_year = 2005; no fans refers to user_fans = 'None';
Question: How many users who have joined Yelp since "2005" but have no fans?
SQL: SELECT count(user_id) FROM users WHERE user_yelping_since_year = 2005 AND user_fans LIKE 'None'
Database: public_review_platform
Note: actively running refers to active = 'TRUE'; Tolleson refers to city = 'Tolleson';
Question: State the number of actively running Yelp businesses in "Tolleson".
SQL: SELECT count(business_id) FROM business WHERE city LIKE 'Tolleson' AND active LIKE 'TRUE'
Database: public_review_platform
Note: user No. refers to user_id;
Question: What is the number of reviews from user No. "21679"?
SQL: SELECT count(review_length) FROM reviews WHERE user_id = 21679
Database: public_review_platform
Note: 5 star reviews refers to review_stars = 5; business No. refers to business_id;
Question: How many "5" star reviews does the Yelp business No. "10682" get?
SQL: SELECT count(review_length) FROM reviews WHERE business_id = 10682 AND review_stars = 5
Database: public_review_platform
Note: closed/not running refers to active = 'False'; most reviews refers to MAX(COUNT(user_id));
Question: Which closed/not running Yelp business in "Sun City" has got the most reviews? Give the business id.
SQL: SELECT business.business_id FROM business INNER JOIN reviews ON business.business_id = reviews.business_id WHERE business.city LIKE 'Sun City' AND business.active LIKE 'FALSE' GROUP BY business.business_id ORDER BY count(reviews.review_length) DESC LIMIT 1
Database: public_review_platform
Note: medium reviews refers to review_length = 'Medium';
Question: For the only Yelp business in "Yuma" city, how many "medium" reviews did it get?
SQL: SELECT count(reviews.review_length) FROM business INNER JOIN reviews ON business.business_id = reviews.business_id WHERE business.city LIKE 'Yuma' AND reviews.review_length LIKE 'Medium'
Database: public_review_platform
Note: business No. refers to business_id; have TV refers to attribute_name = 'Has TV';
Question: Does Yelp business No."4960" have TV?
SQL: SELECT DISTINCT CASE WHEN attributes.attribute_name LIKE 'Has TV' THEN 'yes' ELSE 'no' END FROM attributes INNER JOIN business_attributes ON attributes.attribute_id = business_attributes.attribute_id WHERE business_attributes.business_id = 4960
Database: public_review_platform
Note: number of Yelp businesses refers to business_id; dogs allowed refers to attribute_name = 'Dogs Allowed' AND attribute_value = 'true';
Question: Give the number of "dogs allowed" Yelp businesses.
SQL: SELECT count(business_attributes.business_id) FROM attributes INNER JOIN business_attributes ON attributes.attribute_id = business_attributes.attribute_id WHERE attributes.attribute_name LIKE 'Dogs Allowed' AND business_attributes.attribute_value LIKE 'TRUE'
Database: public_review_platform
Note: how many hours = SUBTRACT(closing_time, opening_time); business No. refers to business_id; open on Saturday refers to day_of_week = 'Saturday';
Question: How many hours does the Yelp business No. "5734" open on Saturday?
SQL: SELECT business_hours.closing_time - business_hours.opening_time AS "hour" FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id WHERE days.day_of_week LIKE 'Saturday' AND business_hours.business_id = 5734
Database: public_review_platform
Note: hair removal refers to category_name = 'Hair Removal';
Question: Tell the number of "hair removal" Yelp businesses.
SQL: SELECT count(categories.category_id) FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id WHERE categories.category_name LIKE 'Hair Removal'
Database: public_review_platform
Note: Chinese refers to category_name = 'Chinese'; Filipino refers to category_name = 'Filipino'; how many more = SUBTRACT(SUM(category_name = 'Chinese'), SUM(category_name = 'Filipino'));
Question: How many more "Chinese" than "Filipino" Yelp businesses?
SQL: SELECT sum(CASE WHEN categories.category_name LIKE 'Chinese' THEN 1 ELSE 0 END) - sum(CASE WHEN categories.category_name LIKE 'Filipino' THEN 1 ELSE 0 END) FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id
Database: public_review_platform
Note: user No. refers to user_id;
Question: User No."63469" has got "1" like for a tip to the Yelp business, which city is that business located in?
SQL: SELECT business.city FROM business INNER JOIN tips ON business.business_id = tips.business_id WHERE tips.likes = 1 AND tips.user_id = 63469
Database: public_review_platform
Note: types of music refers to attribute_name LIKE '%music%' WHERE attribute_value = 'true'; business No. refers to business_id;
Question: How many types of music does Yelp business No."1141" have?
SQL: SELECT count(attributes.attribute_name) FROM attributes INNER JOIN business_attributes ON attributes.attribute_id = business_attributes.attribute_id WHERE business_attributes.attribute_value LIKE 'TRUE' AND business_attributes.business_id = 1141
Database: public_review_platform
Note: type of compliments refers to compliment_type; user No. refers to user_id;
Question: How many "cute" type of compliments does user No. 57400 get?
SQL: SELECT count(compliments.compliment_type) FROM compliments INNER JOIN users_compliments ON compliments.compliment_id = users_compliments.compliment_id WHERE compliments.compliment_type LIKE 'cute' AND users_compliments.user_id = 57400
Database: public_review_platform
Note: type of compliments refers to compliment_type; most number of funny type of compliments refers to MAX(COUNT(number of compliments = 'high' WHERE compliment_type = 'funny'));
Question: Who has got the most number of "funny" type of compliments? Give the user ID.
SQL: SELECT user_id FROM users_compliments WHERE compliment_id IN ( SELECT compliment_id FROM compliments WHERE compliment_type LIKE 'funny' )
Database: public_review_platform
Note: drive-thru refers to attribute_name = 'Drive-Thru' AND attribute_value = 'true'; Scottsdale refers to city = 'Scottsdale'; business_id < 1000;
Question: Give the number of "drive-thru" businesses in "Scottsdale" with business ID number less than "1000".
SQL: SELECT business_attributes.business_id FROM attributes INNER JOIN business_attributes ON attributes.attribute_id = business_attributes.attribute_id INNER JOIN business ON business_attributes.business_id = business.business_id WHERE business.business_id < 1000 AND business.city LIKE 'Scottsdale' AND attributes.attribute_name LIKE 'Drive-Thru' AND business_attributes.attribute_value LIKE 'TRUE'
Database: public_review_platform
Note: open 24 hours refers to attribute_name = 'Open 24 Hours' AND attribute_value = 'true'; rating refers to stars; average rating = AVG(stars);
Question: What is the average rating for the all Yelp businesses that open 24 hours?
SQL: SELECT cast(sum(business.stars) AS REAL) / count(business_attributes.business_id) AS "avg" FROM attributes INNER JOIN business_attributes ON attributes.attribute_id = business_attributes.attribute_id INNER JOIN business ON business_attributes.business_id = business.business_id WHERE attributes.attribute_name LIKE 'Open 24 Hours' AND business_attributes.attribute_value LIKE 'TRUE'
Database: public_review_platform
Note: bring their own beer refers to attribute_name = 'BYOB' AND attribute_value = 'TRUE'; Phoenix refers to city = 'Phoenix'; percentage = MULTIPLY(DIVIDE(SUM(city = 'Phoenix'), COUNT(business_id)), 1.0);
Question: For all the Yelp businesses that allow customers bring their own beer, what percentage of them are in "Phoenix"?
SQL: SELECT cast(sum(CASE WHEN business.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS REAL) * 100 / count(business_attributes.business_id) AS "percentage" FROM attributes INNER JOIN business_attributes ON attributes.attribute_id = business_attributes.attribute_id INNER JOIN business ON business_attributes.business_id = business.business_id WHERE attributes.attribute_name LIKE 'BYOB' AND business_attributes.attribute_value LIKE 'TRUE'
Database: public_review_platform
Note: AZ refers to state = 'AZ'; rating refers to stars;
Question: List the names of business in AZ with a rating of 5.
SQL: SELECT business_id FROM business WHERE state LIKE 'AZ' AND stars = 5
Database: public_review_platform
Note: active businesses refers to active = 'true'; underrated refers to review_count = 'Low';
Question: How many active businesses of city are underrated?
SQL: SELECT count(business_id) FROM business WHERE review_count LIKE 'Low' AND active LIKE 'TRUE'
Database: public_review_platform
Note: user_id BETWEEN 1 AND 20; no fan users refers to user_fans = 'None'; low ratings refers to user_review_count = 'Low';
Question: How many user ids from 1 to 20 have no fan users and have low ratings?
SQL: SELECT count(user_id) FROM users WHERE user_id BETWEEN 1 AND 20 AND user_fans LIKE 'None' AND user_review_count LIKE 'Low'
Database: public_review_platform
Note: opening hours refers to opening_time; category refers to category_name;
Question: Indicate the opening hours of businesses are with category in fashion.
SQL: SELECT business_hours.opening_time FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id INNER JOIN business ON business_categories.business_id = business.business_id INNER JOIN business_hours ON business.business_id = business_hours.business_id WHERE categories.category_name LIKE 'Fashion'
Database: public_review_platform
Note: shopping business refers to category_name = 'Shopping'; opening time before 8AM refers to opening_time < '8AM';
Question: How many businesses operating in the shopping business have opening times before 8AM?
SQL: SELECT count(business.business_id) FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id INNER JOIN business ON business_categories.business_id = business.business_id INNER JOIN business_hours ON business.business_id = business_hours.business_id WHERE business_hours.opening_time < '8AM' AND categories.category_name LIKE 'Shopping'
Database: public_review_platform
Note: category refers to category_name; open after 9pm refers to closing_time > '9PM';
Question: Provide name of businesses whose category is pets and are still opened after 9PM.
SQL: SELECT business.business_id FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id INNER JOIN business ON business_categories.business_id = business.business_id INNER JOIN business_hours ON business.business_id = business_hours.business_id WHERE business_hours.closing_time > '9PM' AND categories.category_name LIKE 'Pets'
Database: public_review_platform
Note: open from Monday to Thursday refers to day_of_week BETWEEN Monday AND Thursday and day_id BETWEEN 2 AND 5;
Question: How many businesses with the category are open from Monday to Thursday?
SQL: SELECT count(business_categories.business_id) FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id INNER JOIN business ON business_categories.business_id = business.business_id INNER JOIN business_hours ON business.business_id = business_hours.business_id INNER JOIN days ON business_hours.day_id = days.day_id WHERE days.day_of_week LIKE 'Monday' OR days.day_of_week LIKE 'Tuesday' OR days.day_of_week LIKE 'Wednesday' OR days.day_of_week LIKE 'Thursday'
Database: public_review_platform
Note: active life refers to category_name = 'active Life'; Phoenix refers to city = 'Phoenix';
Question: Please indicate the review count of the "active life" businesses in Phoenix.
SQL: SELECT count(*) FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id INNER JOIN business ON business_categories.business_id = business.business_id WHERE categories.category_name = 'Active Life' AND business.city = 'Phoenix'
Database: public_review_platform
Note: businesses name refers to business_id; rating refers to stars; stars < 5;
Question: Please list the businesses name with a rating less than 5 whose category name is men's clothing.
SQL: SELECT business_categories.business_id FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id INNER JOIN business ON business_categories.business_id = business.business_id WHERE categories.category_name LIKE 'Men''s Clothing' AND business.stars < 5
Database: public_review_platform
Note: no longer in business refers to active = 'False'; low number of votes useful refers to review_votes_useful = 'Low';
Question: Which businesses are no longer in business but have a low number of votes useful?
SQL: SELECT DISTINCT reviews.business_id FROM reviews INNER JOIN business ON reviews.business_id = business.business_id INNER JOIN business_categories ON business.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id WHERE business.active LIKE 'FALSE' AND reviews.review_votes_useful LIKE 'Low'