Chinastark/bird_dataset huggingface dataset:
Database: public_review_platform
Note: "Noise Level" is the attribute_name; 'Mesa' is the name of city;
Question: How is the "noise level" for the only Yelp business in “Mesa” which got a "Uber" review count?
SQL: SELECT attributes.attribute_name 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 = 'Mesa' AND business.review_count = 'Uber' AND attributes.attribute_name = 'Noise Level'
Database: public_review_platform
Note: business no. 14033 refers to business_id = 14033; good for supper refers to attribute_name = 'good_for_dinner';
Question: Is the Yelp business No. 14033 good for supper?
SQL: SELECT business_attributes.attribute_value FROM business_attributes INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE attributes.attribute_name = 'good_for_dinner' AND business_attributes.business_id = 14033
Database: public_review_platform
Note: Yelp business No. 15098 refers to business_id = '15098'; Monday refers to day_of_week = 'Monday';
Question: How long is the Yelp business No. 15098 opened on Monday?
SQL: SELECT substr(business_hours.closing_time, 1, 2) + 12 - substr(business_hours.opening_time, 1, 2) AS yysj FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id WHERE days.day_of_week = 'Monday' AND business_hours.business_id = 15098
Database: public_review_platform
Note: located in "Phoenix" refers to city = 'Phoenix'; received a "5" star review refers to review_stars = '5'; "uber" number of votes for funny refers to review_votes_funny = 'Uber';
Question: For the Yelp businesses which received a "5" star review with "uber" number of votes for funny, which one is located in "Phoenix"? Give the business ID.
SQL: SELECT business.business_id FROM business INNER JOIN reviews ON business.business_id = reviews.business_id WHERE business.city = 'Phoenix' AND reviews.review_stars = 5 AND reviews.review_votes_funny = 'Uber'
Database: public_review_platform
Note: medium length tip refers to tip_length = 'Medium';
Question: Which city is the business that got a "medium" length tip with "3" likes located in?
SQL: SELECT business.city FROM business INNER JOIN tips ON business.business_id = tips.business_id WHERE tips.tip_length = 'Medium' AND tips.likes = 3
Database: public_review_platform
Note: in "2010" refers to user_yelping_since_year = '2010'; average of "4.5" stars review refers to user_average_stars = '4.5'; uber number of fans refers to user_average_stars = '4.5'; "funny" compliments refers to compliment_type = 'funny';
Question: For the user who joined Yelp in "2010", with an average of "4.5" stars review and has got uber number of fans, how many "funny" compliments has he/she received from other users?
SQL: SELECT count(users_compliments.user_id) FROM users INNER JOIN users_compliments ON users.user_id = users_compliments.user_id INNER JOIN compliments ON users_compliments.compliment_id = compliments.compliment_id WHERE users.user_yelping_since_year = 2010 AND users.user_average_stars = 4.5 AND users.user_fans = 'Uber' AND compliments.compliment_type = 'funny'
Database: public_review_platform
Note: "cool" type compliments refers to compliment_type = 'cool'; user No. 41717 refers to user_id = 41717;
Question: How many "cool" type compliments does user No. 41717 get?
SQL: SELECT count(users_compliments.number_of_compliments) FROM compliments INNER JOIN users_compliments ON compliments.compliment_id = users_compliments.compliment_id WHERE compliments.compliment_type = 'cool' AND users_compliments.user_id = 41717
Database: public_review_platform
Note: business No."11825" refers to business_id = '12476'; have a "parking lot" refers to attribute_value = 'parking_lot';
Question: Does Yelp business No."11825" have a "parking lot"?
SQL: SELECT business_attributes.attribute_value FROM business_attributes INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE business_attributes.business_id = 11825 AND attributes.attribute_name = 'parking_lot'
Database: public_review_platform
Note: Yelp business No."12476" refers to business_id = '12476'; payment in mastercard refers to attribute_value = 'payment_types_mastercard';
Question: Is the payment in mastercard possible for the Yelp business No."12476"?
SQL: SELECT business_attributes.attribute_value FROM business_attributes INNER JOIN attributes ON business_attributes.attribute_id = attributes.attribute_id WHERE business_attributes.business_id = 12476 AND attributes.attribute_name = 'payment_types_mastercard'
Database: public_review_platform
Note: businesses in "Pets" category refers to category_name = 'Pets'; percentage refers to DIVIDE(COUNT(category_name = 'Pets'), COUNT(business_id)) * 100%;
Question: What is the percentage for the Yelp businesses in "Pets" category of all businesses?
SQL: SELECT cast(sum(CASE WHEN categories.category_name = 'Pets' THEN 1 ELSE 0 END) AS REAL) * 100 / count(categories.category_name) FROM business_categories INNER JOIN categories ON business_categories.category_id = categories.category_id
Database: public_review_platform
Note: "Women's Clothing" Yelp businesses refers to  category_name = 'Women''s Clothing'; "Men's Clothing" refers to category_name = 'Men''s Clothing'; times refers to DIVIDE(COUNT(category_name = 'Women''s Clothing'), COUNT(category_name = 'Men''s Clothing'));
Question: How many times is the number of "Women's Clothing" Yelp businesses to "Men's Clothing"?
SQL: SELECT cast(sum(CASE WHEN categories.category_name = 'Women''s Clothing' THEN 1 ELSE 0 END) AS REAL) / sum(CASE WHEN categories.category_name = 'Men''s Clothing' THEN 1 ELSE 0 END) AS times FROM business_categories INNER JOIN categories ON business_categories.category_id = categories.category_id
Database: public_review_platform
Note: the ID refers to business_id; active status refers to active; active = 'true' means the business is still running; active = 'false' means the business is closed or not running now;
Question: Write down the ID, active status and city of the business which are in CA state.
SQL: SELECT business_id, active, city FROM business WHERE state = 'CA' AND active = 'true'
Database: public_review_platform
Note: running business refers to active = 'true'; percentage refers to DIVIDE(COUNT(active = 'true'), COUNT(business_id)) * 100%;
Question: Calculate the percentage of running business among all business.
SQL: SELECT cast(sum(CASE WHEN active = 'true' THEN 1 ELSE 0 END) AS REAL) * 100 / count(business_id) FROM business
Database: public_review_platform
Note: attribute name which start with "music" refers to attribute_name LIKE 'music%';
Question: Among all attribute names, list down the ID and attribute name which start with "music".
SQL: SELECT attribute_id, attribute_name FROM attributes WHERE attribute_name LIKE 'music%'
Database: public_review_platform
Note: 2006 and 2007 refers to BETWEEN 2006 AND 2007; greater number in elite user refers to count(user_id);
Question: Between 2006 and 2007, which year ID had the greater number in elite user?
SQL: SELECT year_id FROM elite WHERE year_id IN (2006, 2007) GROUP BY year_id ORDER BY count(user_id) DESC LIMIT 1
Database: public_review_platform
Note: low number of compliments refers to number_of_compliments = 'Low'; percentage refers to DIVIDE(COUNT(number_of_compliments = 'Low'), COUNT(user_id)) * 100;
Question: Based on all user compliments, find the percentage of low number of compliments on all compliments ID.
SQL: SELECT cast(sum(CASE WHEN number_of_compliments = 'Low' THEN 1 ELSE 0 END) AS REAL) * 100 / count(user_id) FROM users_compliments
Database: public_review_platform
Note: got uber for cool votes refers to review_votes_cool = 'Uber';
Question: List down the business ID and user ID who got uber for cool votes.
SQL: SELECT business_id, user_id FROM reviews WHERE review_votes_cool = 'Uber'
Database: public_review_platform
Note: started using Yelp since 2004 refers to user_yelping_since_year = '2004'; had high followers refers to user_fans = 'High';
Question: Write the user ID, business ID and tips length of who started using Yelp since 2004 and had high followers.
SQL: SELECT users.user_id, tips.business_id, tips.tip_length FROM users INNER JOIN tips ON users.user_id = tips.user_id WHERE users.user_yelping_since_year = 2004 AND users.user_fans = 'High'
Database: public_review_platform
Note: review votes of funny refers to review_votes_funny = 'Uber'; cool hit uber refers to review_votes_cool = 'Uber'; user year of joining Yelp refers to user_yelping_since_year;
Question: Among the review votes of funny and cool hit uber with long review length, describe the business ID, active status, user ID and user year of joining Yelp.
SQL: SELECT business.business_id, business.active, users.user_id, users.user_yelping_since_year FROM business INNER JOIN reviews ON business.business_id = reviews.business_id INNER JOIN users ON reviews.user_id = users.user_id WHERE reviews.review_votes_cool = 'Uber' AND reviews.review_votes_funny = 'Uber' AND reviews.review_length = 'Long'
Database: public_review_platform
Note: active status refers to active; active = 'true' means the business is still running; active = 'false' means the business is inactive or not running now;
Question: Under the attribute name of "music_playlist", describe the attribute ID, business ID, city and inactive status.
SQL: SELECT attributes.attribute_id, business_attributes.business_id, business.city 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 = 'music_playlist' AND business.active = 'false'
Database: public_review_platform
Note: percentage refers to DIVIDE(COUNT(attribute_name = 'Accepts Credit Cards'), COUNT(business_id))*100%;
Question: Calculate the percentage of business with attribute name of "Accepts Credit Cards".
SQL: SELECT cast(sum(CASE WHEN attributes.attribute_name = 'Accepts Credit Cards' THEN 1 ELSE 0 END) AS REAL) * 100 / count(attributes.attribute_name) FROM attributes INNER JOIN business_attributes ON attributes.attribute_id = business_attributes.attribute_id
Database: public_review_platform
Note: stop businesses refers to active = 'false'; great experience refers to review_stars = 5;
Question: Among the stopped businesses in San Tan Valley city, list down the user ID and review length of who had great experience.
SQL: SELECT reviews.user_id, reviews.review_length FROM business INNER JOIN reviews ON business.business_id = reviews.business_id WHERE business.city = 'San Tan Valley' AND business.active = 'false' AND reviews.review_stars = 5
Database: public_review_platform
Note: number of compliments reach uber refers to number_of_compliments = 'Uber'; elite year refers to year_id; user average star refers to user_average_stars;
Question: Mention the user average star, elite year and the compliment type of user ID 6027 whereby number of compliments reach uber.
SQL: SELECT users.user_average_stars, elite.year_id, compliments.compliment_type, users_compliments.number_of_compliments FROM elite INNER JOIN users ON elite.user_id = users.user_id INNER JOIN users_compliments ON users.user_id = users_compliments.user_id INNER JOIN compliments ON users_compliments.compliment_id = compliments.compliment_id INNER JOIN years ON elite.year_id = years.year_id WHERE users_compliments.number_of_compliments = 'Uber' AND users_compliments.user_id = 6027
Database: public_review_platform
Question: Under the category name of "Coffee & Tea", mention any 5 business ID , their state and city.
SQL: SELECT business_categories.business_id, business.state, business.city 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 = 'Coffee & Tea' LIMIT 5
Database: public_review_platform
Note: above 10% refers to DIVIDE(COUNT(business_categories.business_id = category_id), COUNT(category_id)) * 100% > 10%;
Question: Describe category name which had above 10% in comparing with all business and categories.
SQL: SELECT categories.category_name FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id GROUP BY business_categories.category_id HAVING count(business_categories.business_id) > ( SELECT count(business_categories.business_id) FROM business_categories ) * 0.1
Database: public_review_platform
Note: with great experience refers to stars = 5;
Question: For the business with great experience existed in Sun Lakes city, provide the user ID who gave review on it and user followers.
SQL: SELECT users.user_id, users.user_fans FROM business INNER JOIN reviews ON business.business_id = reviews.business_id INNER JOIN users ON reviews.user_id = users.user_id WHERE business.city = 'Sun Lakes' AND business.stars = 5
Database: public_review_platform
Note: category of "Men's Clothing" refers to category_name = 'Men''s Clothing'; "Women's Clothing" refers to category_name = 'Women''s Clothing';
Question: Compare the number of business between the category of "Men's Clothing" and "Women's Clothing".
SQL: SELECT sum(CASE WHEN categories.category_name = 'Men''s Clothing' THEN 1 ELSE 0 END) - sum(CASE WHEN categories.category_name = 'Women''s Clothing' THEN 1 ELSE 0 END) AS diff FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id
Database: public_review_platform
Note: highest quality user refers to number_of_compliments = 'Uber'; user of under ID 100 refers to user_id < 100 ;
Question: Among highest quality user of under ID 100, mention compliment type which got highest compliment number and user's followers.
SQL: SELECT compliments.compliment_type, users.user_fans FROM compliments INNER JOIN users_compliments ON compliments.compliment_id = users_compliments.compliment_id INNER JOIN users ON users_compliments.user_id = users.user_id WHERE users_compliments.number_of_compliments = 'Uber' AND users_compliments.user_id < 100
Database: public_review_platform
Note: closed at 8PM refers to closing_time = '8PM';
Question: List all the businesses that closed at 8PM.
SQL: SELECT DISTINCT business_id FROM business_hours WHERE closing_time = '8PM'
Database: public_review_platform
Note: located in Phoenix refers to city = 'Phoenix'; Arizona refers to state = 'AZ';
Question: How many 2 stars rated business located in Phoenix, Arizona?
SQL: SELECT count(business_id) FROM business WHERE city = 'Phoenix' AND state = 'AZ' AND stars = 2
Database: public_review_platform
Note: in Tempe refers to city = 'Tempe'; rated as 'Wonderful experience refers to stars > 3;
Question: How many businesses in Tempe are rated as 'Wonderful experience?
SQL: SELECT count(business_id) FROM business WHERE city = 'Phoenix' AND stars > 3
Database: public_review_platform
Note: average star less than 3 stars refers to user_average_stars < 3; in 2012 refers to user_yelping_since_year = 2012;
Question: List all the users with average star less than 3 stars in 2012
SQL: SELECT user_id FROM users WHERE user_yelping_since_year = 2012 AND user_average_stars < 3
Database: public_review_platform
Note: percentage refers to DIVIDE(COUNT(stars = 5), COUNT(business_id)) * 100%;
Question: Find the percentage of 5 stars rated business.
SQL: SELECT cast(sum(CASE WHEN stars = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / count(stars) FROM business
Database: public_review_platform
Note: highest number of reviews refers to SUBTRACT(MAX(COUNT(business_id), MIN(COUNT(business_id))));
Question: Calculate difference between business that have the highest number of reviews and business that have the lowest number of reviews.
SQL: SELECT ( SELECT count(business_id) FROM reviews GROUP BY business_id ORDER BY count(business_id) DESC LIMIT 1 ) - ( SELECT count(business_id) FROM reviews GROUP BY business_id ORDER BY count(business_id) ASC LIMIT 1 ) AS diff
Database: public_review_platform
Note: tires businesses refers to category_name = 'Tires'; opened everyday refers to COUNT(distinct opening_time) = 7;
Question: List all the tires businesses that are opened everyday.
SQL: SELECT DISTINCT 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 WHERE categories.category_name = 'Tires' GROUP BY business_categories.business_id HAVING count(day_id) = 7
Database: public_review_platform
Note: in 2012 refers to actual_year = 2012;
Question: Which users become an elite in 2012?
SQL: SELECT DISTINCT elite.user_id FROM elite INNER JOIN years ON elite.year_id = years.year_id WHERE years.actual_year = 2012
Database: public_review_platform
Note: shopping business refers to category_name = 'Shopping'; 4 stars ratings refers to stars = 4;
Question: List the business ID of shopping business that have 4 stars ratings.
SQL: SELECT 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 categories.category_name = 'Shopping' AND business.stars = 4
Database: public_review_platform
Note: on Sunday refers to day_of_week = 'Sunday'; low check-in at 10AM refers to label_time_10 = 'Low';
Question: How many business have low check-in on Sunday at 10AM?
SQL: SELECT count(checkins.business_id) FROM days INNER JOIN checkins ON days.day_id = checkins.day_id WHERE days.day_of_week = 'Sunday' AND checkins.label_time_10 = 'Low'
Database: public_review_platform
Note: in Glendale refers to city = 'Glendale';
Question: How many businesses in Glendale are reviewed by user with the ID of 20241?
SQL: SELECT count(business.business_id) FROM business INNER JOIN reviews ON business.business_id = reviews.business_id WHERE business.city = 'Glendale' AND reviews.user_id = 20241
Database: public_review_platform
Note: location refers to city; Pet Services business refers to category_name = 'Pet Services';
Question: State the locations of all Pet Services business.
SQL: SELECT business.city 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 = 'Pet Services'
Database: public_review_platform
Note: photos type compliment refers to compliment_type = 'photos'; high cool votes refers to review_votes_cool = 'High';
Question: How many photos type compliment given from users with high cool votes?
SQL: SELECT count(users.user_id) FROM users INNER JOIN users_compliments ON users.user_id = users_compliments.user_id INNER JOIN compliments ON users_compliments.compliment_id = compliments.compliment_id INNER JOIN reviews ON users.user_id = reviews.user_id WHERE compliments.compliment_type = 'photos' AND reviews.review_votes_cool = 'High'
Database: public_review_platform
Note: closed refers to active = 'false'; more than 10 attributes refers to count(attribute_id) > 10;
Question: How many closed businesses that have more than 10 attributes?
SQL: SELECT count(*) FROM business WHERE business_id IN ( SELECT business.business_id FROM business INNER JOIN business_attributes ON business.business_id = business_attributes.business_id WHERE business.active = 'false' GROUP BY business.business_id HAVING count(DISTINCT business_attributes.attribute_id) > 10 )
Database: public_review_platform
Note: in Mesa refers to city = 'Mesa'; alcohol attribute refers to attribute_name = 'Alcohol';
Question: List the business located in Mesa that have alcohol attribute.
SQL: SELECT 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 = 'Mesa' AND attributes.attribute_name = 'Alcohol'
Database: public_review_platform
Note: in Chandelier refers to city = 'Chandelier'; percentage = divide(count(business_id where review_votes_funny = 'Low'), count(business_id)); business with low funny votes refers to review_votes_funny = 'Low';
Question: Based on business in Phoenix, calculate the percentage of business with low funny votes.
SQL: SELECT cast(sum(CASE WHEN reviews.review_votes_funny = 'Low' THEN 1 ELSE 0 END) AS REAL) * 100 / count(business.business_id) FROM business INNER JOIN reviews ON business.business_id = reviews.business_id WHERE business.city = 'Phoenix'
Database: public_review_platform
Note: ratio = divide(count(business_id where category_name = 'Shopping'), count(business_id where category_name = 'Pets'));
Question: What is the ratio between business in shopping category and business in pets category?
SQL: SELECT cast(sum(CASE WHEN categories.category_name = 'Shopping' THEN 1 ELSE 0 END) AS REAL) / sum(CASE WHEN categories.category_name = 'Pets' THEN 1 ELSE 0 END) AS radio FROM business_categories INNER JOIN categories ON business_categories.category_id = categories.category_id
Database: public_review_platform
Note: category refers to category_name;
Question: How many businesses are registered in the database under 'Banks & Credit Unions' category?
SQL: SELECT count(business_categories.business_id) FROM categories INNER JOIN business_categories ON categories.category_id = business_categories.category_id WHERE categories.category_name = 'Banks & Credit Unions'
Database: public_review_platform
Note: active business refers to active = 'true'; Casa Grande refers to city = 'Casa Grande';
Question: How many active businesses from Casa Grande are registered in the database?
SQL: SELECT count(business_id) FROM business WHERE active = 'true' AND city = 'Casa Grande'
Database: public_review_platform
Note: open time refers to opening_time; on Monday refers to day_of_week = 'Monday'; business with ID no. refers to business_id;
Question: What time does the business with ID no.12 open on Monday?
SQL: SELECT business_hours.opening_time FROM business_hours INNER JOIN days ON business_hours.day_id = days.day_id WHERE business_hours.business_id = 12 AND days.day_of_week = 'Monday'
Database: public_review_platform
Note: can be attributed to 'Good for Kids' refers to attribute_name = 'Good for Kids' and attribute_value = 'true';
Question: How many businesses that are registered in the database can be attributed to 'Good for Kids'?
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 = 'Good for Kids' AND business_attributes.attribute_value = 'true'
Database: public_review_platform
Note: most popular and appealing refers to review_count = 'High' and max(stars); active business refers to active = 'true'; in Gilbert refers to city = 'Gilbert';
Question: Identify the most popular and appealing active business in Gilbert based on users' reviews.
SQL: SELECT business_id FROM business WHERE city = 'Gilbert' AND active = 'true' AND review_count = 'High' ORDER BY stars DESC LIMIT 1
Database: public_review_platform
Note: 5-star refers to stars = 5; in Ahwatukee refers to city = 'Ahwatukee'; business category refers to category_name;
Question: Find the 5-star business in Ahwatukee, AZ and identify it's business category.
SQL: SELECT business.business_id, 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.city = 'Ahwatukee' AND business.stars = 5