Chinastark/bird_dataset huggingface dataset:
Database: public_review_platform
Note: categories refers to category_name; in Arizona refers to state = 'AZ';
Question: Please list all the categories of the Yelp_Business in Arizona.
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 WHERE business.state LIKE 'AZ' GROUP BY categories.category_name
Database: public_review_platform
Note: "How long" and "how much time" are synonyms; how much time does this business open refers to subtract(closing_time, opening_time); Yelp_business no.1 refers to business_id = 1; Tuesdays refers to day_of_week = 'Tuesday';
Question: How long does Yelp_Business no.1 open on Tuesdays?
SQL: SELECT business_hours.closing_time - business_hours.opening_time AS "opening hours" FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id WHERE days.day_of_week LIKE 'Tuesday' AND business_hours.business_id = 1
Database: public_review_platform
Note: Yelp_business no.1 refers to business_id = 1; open on refers to opening_time; Tuesdays refers to day_of_week = 'Tuesday';
Question: When does Yelp_Business no.1 open on Tuesdays?
SQL: SELECT business_hours.opening_time FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id WHERE days.day_of_week LIKE 'Tuesday' AND business_hours.business_id = 1
Database: public_review_platform
Note: close after 8PM refers to closing_time = '9PM' or closing_time = '10PM' closing_time = '11PM' closing_time = '12PM'; Mondays refers to day_of_week = 'Monday';
Question: How many Yelp_Business close after 8PM on Mondays?
SQL: SELECT count(business_hours.business_id) FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id WHERE days.day_of_week LIKE 'Monday' AND business_hours.closing_time > '8PM'
Database: public_review_platform
Note: Mondays refers to day_of_week = 'Monday'; in Anthem refers to city = 'Anthem'; are still running refers to active = 'true';
Question: Please list the opening time on Mondays of all the Yelp_Businesses in Anthem that are still running.
SQL: SELECT business_hours.opening_time FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id INNER JOIN business ON business_hours.business_id = business.business_id WHERE days.day_of_week LIKE 'Monday' AND business.city LIKE 'Anthem' AND business.active LIKE 'True' GROUP BY business_hours.opening_time
Database: public_review_platform
Note: in Arizona refers to state = 'AZ'; closes at 12PM refers to closing_time = '12PM'; on Sundays refers to day_of_week = 'Sunday';
Question: Among the Yelp_Business in Arizona, how many of them closes at 12PM on Sundays?
SQL: SELECT count(business_hours.business_id) FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id INNER JOIN business ON business_hours.business_id = business.business_id WHERE days.day_of_week LIKE 'Sunday' AND business_hours.closing_time LIKE '12PM' AND business.state LIKE 'AZ'
Database: public_review_platform
Note: categories refers to category_name; closes at 12PM refers to closing_time = '12PM'; on Sundays refers to day_of_week = 'Sunday';
Question: Please list the categories of the Yelp_Business that closes at 12PM on Sundays.
SQL: SELECT categories.category_name FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id INNER JOIN business_categories ON business_hours.business_id = business_categories.business_id INNER JOIN categories ON categories.category_id = categories.category_id WHERE business_hours.closing_time = '12PM' AND days.day_of_week = 'Sunday' GROUP BY categories.category_name
Database: public_review_platform
Note: Good for Kids refers to attribute_name = 'Good for Kids'and attribute_value = 'true'; open everyday refers to day_id between 1 and 7;
Question: How many "Good for Kids" Yelp_Businesses are open everyday of the week?
SQL: SELECT count(business_hours.business_id) FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id INNER JOIN business_attributes ON business_hours.business_id = business_attributes.business_id INNER JOIN attributes ON attributes.attribute_id = attributes.attribute_id WHERE days.day_id IN (1, 2, 3, 4, 5, 6, 7) AND attributes.attribute_name = 'Good for Kids' AND business_attributes.attribute_value = 'true'
Database: public_review_platform
Note: became an elite user the same year they joined Yelp refers to user_yelping_since_year = year_id;
Question: How many users became an elite user the same year they joined Yelp?
SQL: SELECT count(users.user_id) FROM users INNER JOIN elite ON users.user_id = elite.user_id WHERE users.user_yelping_since_year = elite.year_id
Database: public_review_platform
Note: longest business time refers to max(subtract(closing_time, opening_time)); on Mondays refers to day_of_week = 'Monday';  category "Shopping" refers to category_name = 'Shopping';
Question: What is the longest business time on Mondays for a Yelp_Business under the category "Shopping"?
SQL: SELECT business_hours.closing_time + 12 - business_hours.opening_time AS "hour" FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id INNER JOIN business ON business_hours.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 days.day_of_week LIKE 'Monday' AND categories.category_name LIKE 'Shopping' ORDER BY business_hours.closing_time + 12 - business_hours.opening_time DESC LIMIT 1
Database: public_review_platform
Note: business time of longer than 12 hours refers to subtract(closing_time, opening_time) > 12; on Sundays refers to day_of_week = 'Sunday';
Question: Please list the business IDs of the Yelp_Business that have a business time of longer than 12 hours on Sundays.
SQL: SELECT business_hours.business_id FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id INNER JOIN business ON business_hours.business_id = business.business_id WHERE business_hours.closing_time + 12 - business_hours.opening_time > 12 AND days.day_of_week LIKE 'Sunday' GROUP BY business_hours.business_id
Database: public_review_platform
Note: Yelp_business no.1 refers to business_id = 1;
Question: How many elite users have reviewed Yelp_Business no.1?
SQL: SELECT count(users.user_id) FROM users INNER JOIN elite ON users.user_id = elite.user_id INNER JOIN reviews ON users.user_id = reviews.user_id WHERE reviews.business_id = 1
Database: public_review_platform
Note: posted more than 10 reviews refers to count(reviews.user_id) > 10;
Question: Among the users who have posted more than 10 reviews, how many users are elite users?
SQL: SELECT count(t4.user_id) FROM ( SELECT users.user_id FROM users INNER JOIN elite ON users.user_id = elite.user_id INNER JOIN reviews ON users.user_id = reviews.user_id WHERE reviews.user_id IS NOT NULL GROUP BY reviews.user_id HAVING count(reviews.user_id) > 10 ) t4
Database: public_review_platform
Note: Arizona refers to state = 'AZ'; gets the most number of reviews refers to max(count(reviews.business_id));
Question: Which Yelp_Business in Arizona gets the most number of reviews?
SQL: SELECT reviews.user_id FROM reviews INNER JOIN business ON reviews.business_id = business.business_id WHERE business.state LIKE 'AZ' GROUP BY reviews.user_id ORDER BY count(reviews.user_id) DESC LIMIT 1
Database: public_review_platform
Note: in Anthem refers to city = 'Anthem'; stars on average = avg(review_stars);
Question: How many stars on average does a Yelp_Business in Anthem get from a user review?
SQL: SELECT avg(reviews.review_stars) FROM business INNER JOIN reviews ON business.business_id = reviews.business_id WHERE business.city LIKE 'Anthem'
Database: public_review_platform
Note: user no.3 refers to user_id = 3; in Arizona refers to state = 'AZ'; stars on average = avg(review_stars(user_id = 3));
Question: How many stars on average does user no.3 give to Yelp_Business in Arizona?
SQL: SELECT avg(reviews.review_stars) FROM business INNER JOIN reviews ON business.business_id = reviews.business_id WHERE business.state LIKE 'AZ' AND reviews.user_id = 3
Database: public_review_platform
Note: Yelp_business no.1 refers to business_id = 1; on weekends refers to day_of_week = 'Saturday' or day_of_week = 'Sunday'; average business time refers to DIVIDE(SUBTRACT(closing_time, opening_time), 2);
Question: What is the average business time for Yelp_Business no.1 on weekends?
SQL: SELECT business_hours.closing_time + 12 - business_hours.opening_time AS "avg opening hours" FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id WHERE business_hours.business_id = 1 AND (days.day_of_week = 'Sunday' OR days.day_of_week = 'Sunday')
Database: public_review_platform
Note: average elitestar rating refers to DIVIDE(SUM(stars), COUNT(business_id)); closes at 12PM refers to closing_time = '12PM'; on Sundays refers to day_of_week = 'Sunday';
Question: What is the average Elitestar rating for a Yelp_Business that closes at 12PM on Sundays?
SQL: SELECT cast(sum(business.stars) AS REAL) / count(business_hours.business_id) AS "average stars" FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id INNER JOIN business ON business_hours.business_id = business.business_id WHERE days.day_of_week LIKE 'Sunday' AND business_hours.closing_time LIKE '12PM'
Database: public_review_platform
Note: in Casa Grande refers to city = 'Casa Grande';
Question: How many of the busineses are in Casa Grande?
SQL: SELECT count(city) FROM business WHERE city LIKE 'Casa Grande'
Database: public_review_platform
Note: active businesses refers to active = 'true'; in AZ refers to state = 'AZ';
Question: What is the total number of active businesses in AZ with a low review count?
SQL: SELECT count(business_id) FROM business WHERE state LIKE 'AZ' AND active LIKE 'True' AND review_count LIKE 'low'
Database: public_review_platform
Note: star range from 2 to 3 refers to stars >= 2 AND stars < 4;  located at Mesa refers to city = 'Mesa';
Question: List down the business ID with a star range from 2 to 3, located at Mesa.
SQL: SELECT business_id FROM business WHERE city LIKE 'Mesa' AND stars BETWEEN 2 AND 3
Database: public_review_platform
Note: In users yelping since 2011 to 2013 refers to user_yelping_since_year >= 2011 AND user_yelping_since_year < 2014;
Question: In users yelping since 2011 to 2013, how many of them have high count of fans?
SQL: SELECT count(user_id) FROM users WHERE user_yelping_since_year BETWEEN 2011 AND 2013 AND user_fans LIKE 'High'
Database: public_review_platform
Note: user 35026 refers to user_id = 35026;
Question: What is the review length of user 35026 to business with business ID 2?
SQL: SELECT review_length FROM reviews WHERE user_id = 35026 AND business_id = 2
Database: public_review_platform
Note: in Chandler refers to city = 'Chandler'; attribute refers to attribute_name;
Question: Among the businesses in Chandler, list the attribute of the business with a low review count.
SQL: SELECT DISTINCT attributes.attribute_id, attributes.attribute_name FROM business INNER JOIN business_attributes ON business.business_id = business_attributes.attribute_id INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE business.review_count = 'Low' AND business.city = 'Chandler'
Database: public_review_platform
Note: category of mexican refers to category_name = 'Mexican'; star rating below 4 refers to stars < 4;
Question: In businesses with a category of mexican, how many of them has a star rating below 4?
SQL: SELECT count(business.business_id) FROM business 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.stars < 4 AND categories.category_name LIKE 'Mexican'
Database: public_review_platform
Note: active business refers to active = 'true'; category of Fashion refers to category = 'Fashion';
Question: List the active business ID and its stars of the businesses fall under the category of Fashion.
SQL: SELECT business.business_id, business.stars FROM business 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 'TRUE' AND categories.category_name LIKE 'Fashion'
Database: public_review_platform
Note: category refers to category_name; highest star rating refers to max(stars);
Question: What is the category of businesses with highest star rating?
SQL: SELECT categories.category_name FROM business INNER JOIN business_categories ON business.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id ORDER BY business.stars DESC LIMIT 1
Database: public_review_platform
Note: category refers to category_name; highest review stars refers to max(review_stars); business ID from 6 to 9 refers to business_id between 6 and 9;
Question: What is the category of the business with medium review length and highest review stars within business ID from 6 t0 9?
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 'Medium' AND business.business_id BETWEEN 6 AND 9 ORDER BY reviews.review_stars DESC LIMIT 1
Database: public_review_platform
Note: active businesses refers to active = 'true'; attribute of caters refers to attribute_name = 'Caters';
Question: Count the active businesses that has an attribute of caters with low review count.
SQL: SELECT count(business.business_id) FROM business INNER JOIN business_attributes ON business.business_id = business_attributes.business_id INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE attributes.attribute_name LIKE 'Caters' AND business.review_count LIKE 'Low' AND business.active LIKE 'TRUE'
Database: public_review_platform
Note: located at Tempe refers to city = 'Tempe'; highest star rating refers to max(stars);
Question: What is the closing and opening time of businesses located at Tempe with highest star rating?
SQL: SELECT business_hours.closing_time, business_hours.opening_time FROM business INNER JOIN business_hours ON business.business_id = business_hours.business_id WHERE business.city LIKE 'Tempe' ORDER BY business.stars DESC LIMIT 1
Database: public_review_platform
Note: active businesses refers to active = 'true'; located at Chandler, AZ refers to city = 'Chandler', state = 'AZ'; category refers to category_name; atrributes refers to attribute_name;
Question: Among the active businesses located at Chandler, AZ, list the category and atrributes of business with a medium review count.
SQL: SELECT categories.category_name, attributes.attribute_name FROM business INNER JOIN business_categories ON business.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id INNER JOIN business_attributes ON business.business_id = business_attributes.business_id INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE business.active LIKE 'TRUE' AND business.state LIKE 'AZ' AND business.city LIKE 'Chandler' AND business.review_count LIKE 'Medium'
Database: public_review_platform
Note: categories refers to category_name; active businesses refers to active = 'true'; in Surprise, AZ refers to city = 'Surprise' and state = 'AZ';
Question: List the categories of active businesses in Surprise, AZ.
SQL: SELECT categories.category_name FROM business 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 'TRUE' AND business.state LIKE 'AZ' AND business.city LIKE 'Surprise' GROUP BY categories.category_name
Database: public_review_platform
Note: location of businesses refers to city and state; business hours from 8 am to 9 pm refers to opening_time = '8AM', closing_time = '9PM'; every Friday refers to day_of_week = 'Friday';
Question: Find the location of businesses that have business hours from 8 am to 9 pm every Friday.
SQL: SELECT business.city FROM business INNER JOIN business_hours ON business.business_id = business_hours.business_id INNER JOIN days ON business_hours.day_id = days.day_id WHERE business_hours.closing_time LIKE '9PM' AND business_hours.opening_time LIKE '8AM' AND days.day_of_week LIKE 'Friday' GROUP BY business.city
Database: public_review_platform
Note: active business refers to active = 'true'; located at Mesa, AZ refers to city = 'Mesa', state = 'AZ';
Question: What is the attribute value of an active business with a high review count and 3 stars which is located at Mesa, AZ?
SQL: SELECT business_attributes.attribute_value FROM business INNER JOIN business_attributes ON business.business_id = business_attributes.business_id INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE business.state LIKE 'AZ' AND business.review_count LIKE 'High' AND business.active LIKE 'TRUE' AND business.city LIKE 'Mesa' AND business.stars = 3
Database: public_review_platform
Note: active businesses refers to active = 'true'; in Chandler refers to city = 'Chandler';
Question: What is the opening time of the active businesses in Chandler that has a medium review count.
SQL: SELECT DISTINCT business_hours.opening_time FROM business INNER JOIN business_hours ON business.business_id = business_hours.business_id INNER JOIN days ON business_hours.day_id = days.day_id WHERE business.city LIKE 'Chandler' AND business.active LIKE 'TRUE' AND business.review_count LIKE 'Medium'
Database: public_review_platform
Note: category of Accessories refers to category_name = 'Accessories'; percentage of the business with less than 4 stars = divide(count(business.business_id(stars < 4)), count(business.business_id)) * 100%;
Question: Among the businesses with a category of Accessories, what is the percentage of the business with less than 4 stars?
SQL: SELECT cast(sum(CASE WHEN business.stars < 4 THEN 1 ELSE 0 END) AS REAL) * 100 / count(business.stars) AS "percentage" FROM business INNER JOIN business_categories ON business.business_id = business_categories.business_id INNER JOIN categories ON business_categories.category_id = categories.category_id WHERE categories.category_name LIKE 'Accessories'
Database: public_review_platform
Note: active businesses refers to active = 'true'; in Tempe refers to city = 'Tempe'; with stars greater than the 70% of average age of star rating refers to stars > DIVIDE(sum(stars), COUNT(business_id)) * 70%;
Question: List the closing time and day of week of active businesses in Tempe with stars greater than the 70% of average age of star rating.
SQL: SELECT business_hours.closing_time, days.day_of_week FROM business INNER JOIN business_hours ON business.business_id = business_hours.business_id INNER JOIN days ON business_hours.day_id = days.day_id WHERE business.city LIKE 'Tempe' AND business.active LIKE 'TRUE' AND business.stars > 0.7 * ( SELECT avg(business.stars) FROM business INNER JOIN business_hours ON business.business_id = business_hours.business_id INNER JOIN days ON business_hours.day_id = days.day_id WHERE business.city LIKE 'Tempe' AND business.active LIKE 'TRUE' )
Database: public_review_platform
Note: active business refers to active = 'true'; 'Phoenix' is the city;
Question: How many active businesses are located at Phoenix, Arizona?
SQL: SELECT count(business_id) FROM business WHERE city LIKE 'Phoenix' AND active LIKE 'True'
Database: public_review_platform
Note: high review count refers to review_count = 'High';
Question: How many businesses are with high review count?
SQL: SELECT count(business_id) FROM business WHERE review_count LIKE 'High'
Database: public_review_platform
Note: attribute_value = 'beer_and_wine';
Question: How many businesses ID sell beer and wine?
SQL: SELECT count(business_id) FROM business_attributes WHERE attribute_id = 1 AND attribute_value = 'beer_and_wine'
Database: public_review_platform
Question: How many attributes ID owned by business ID 2?
SQL: SELECT count(attribute_id) FROM business_attributes WHERE business_id = 2
Database: public_review_platform
Note: high compliments refers to number_of_compliments = 'High'; type in photo refers to compliment_id = 1;
Question: How many users received high compliment type in photo?
SQL: SELECT count(users_compliments.user_id) FROM users_compliments INNER JOIN compliments ON users_compliments.compliment_id = compliments.compliment_id WHERE users_compliments.number_of_compliments LIKE 'High' AND compliments.compliment_id = 1
Database: public_review_platform
Note: 'Phoenix' is the city; waiter service refers to attribute_name = 'waiter_services';
Question: How many businesses in Phoenix, Arizona is attributed to waiter service?
SQL: SELECT count(business.business_id) FROM business INNER JOIN business_attributes ON business.business_id = business_attributes.business_id INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE business.city LIKE 'Phoenix' AND attributes.attribute_name LIKE 'waiter_service' AND business_attributes.attribute_id = 2
Database: public_review_platform
Note: opened for 24/7 refers to business_hours WHERE opening_time = closing_time and business_id COUNT(day_id) = 7; business attribute refers to attribute_name;
Question: Find out which business is opened for 24/7 and list out what is the business attribute.
SQL: SELECT attributes.attribute_name FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id INNER JOIN business ON business_hours.business_id = business.business_id INNER JOIN business_attributes ON business.business_id = business_attributes.business_id INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE days.day_id LIKE '1' AND '2' AND '3' AND '4' AND '5' AND '6' AND '7' AND business_hours.opening_time = business_hours.closing_time GROUP BY attributes.attribute_name
Database: public_review_platform
Note: 'Fashion' is the category_name; most review refers to Max(Count(user_id));
Question: Which business in fashion category has the most review?
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 reviews ON business.business_id = reviews.business_id WHERE categories.category_name LIKE 'Fashion' AND categories.category_id = 7 GROUP BY business.business_id ORDER BY count(reviews.user_id) DESC LIMIT 1
Database: public_review_platform
Note: average good review refers to review_count >= 3; Arizona refers to state = 'AZ'; business category refers to category_name;
Question: List out which business category that are most likely to have average good review in Arizona?
SQL: SELECT DISTINCT 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 business.state LIKE 'AZ' AND reviews.review_stars >= 3
Database: public_review_platform
Note: best elite refers to user_average_stars = 5; worse eliter refers to user_average_stars = 1: in 2013 refers to year_id = 2013; ratio = Divide(Count(user_id(user_average_stars = 5)),  Count(user_id(user_average_stars = 1)));
Question: What is the ratio of having the best to worse elite user in 2013?
SQL: SELECT cast(sum(CASE WHEN users.user_average_stars = 1 THEN 1 ELSE 0 END) AS REAL) / count(elite.user_id) , sum(CASE WHEN users.user_average_stars = 5 THEN 1 ELSE 0 END) * 1.0 / count(elite.user_id) FROM users INNER JOIN elite ON users.user_id = elite.user_id WHERE elite.year_id = 2013