db_id
stringclasses
68 values
question
stringlengths
24
325
evidence
stringlengths
0
580
SQL
stringlengths
23
728
public_review_platform
What are the categories that business number 15 belongs to?
business number refers to business_id;
SELECT T2.category_name FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id WHERE T1.business_id = 15
public_review_platform
How many businesses are there in Scottsdale city under the category of "Beauty & Spas"?
category refers to category_name;
SELECT COUNT(T2.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.city LIKE 'Scottsdale' AND T1.category_name LIKE 'Beauty & Spas'
public_review_platform
Please list any two user numbers that have an "Uber" number of cute compliments.
user numbers refers to user_id; Uber number refers to number_of_compliments = 'Uber'; cute compliments refers to compliment_type = 'cute';
SELECT T1.user_id FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.number_of_compliments LIKE 'Uber' AND T2.compliment_type LIKE 'cute' LIMIT 2
public_review_platform
How many businesses operating in the "Accessories" category have received a "wonderful experience" review from users?
Accessories category refers to category_name = 'Accessories'; wonderful experience review refers to stars > 3;
SELECT COUNT(T2.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.stars > 3 AND T1.category_name LIKE 'Accessories'
public_review_platform
How many businesses in AZ state do not open on Thursday?
do not open on Thursday refers to day_of_week = 'Thursday' AND label_time_4 = 'None';
SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Checkins AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.label_time_4 LIKE 'None' AND T1.state LIKE 'AZ' AND T3.day_of_week LIKE 'Thursday'
public_review_platform
How many businesses of Yelp are in Scottsdale?
Scottsdale refers to city = 'Scottsdale';
SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Scottsdale'
public_review_platform
Among the Yelp_Businesses in Arizona, how many of them are still running?
Arizona refers to state = 'AZ'; still running refers to active = 'true';
SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND active LIKE 'True'
public_review_platform
How many Yelp_Businesses in Scottsdale have received positive comments in the Elitestar rating?
Scottsdale refers to city = 'Scottsdale'; positive comments refers to stars > 3; Elitestar rating refers to stars;
SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Scottsdale' AND stars > 3
public_review_platform
Which city has more Yelp_Business that's more appealing to users, Scottsdale or Anthem?
more appealing to users refers to MAX(review_count);
SELECT city FROM Business ORDER BY review_count DESC LIMIT 1
public_review_platform
How many Yelp_Businesses in Arizona have a Elitestar rating of over 4?
Arizona refers to state = 'AZ'; Elitestar rating of over 4 refers to stars > 4;
SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND stars > 4
public_review_platform
How many Yelp_Businesses are there in Arizona in total?
Arizona refers to state = 'AZ';
SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ'
public_review_platform
Please list the cities of the Yelp_Businesses that have gotten a 5 in the Elitestar rating.
5 in the Elitestar rating refers to stars = 5;
SELECT city FROM Business WHERE stars = 5 GROUP BY city
public_review_platform
How many reviews have the user whose ID is 3 posted?
SELECT COUNT(review_length) FROM Reviews WHERE user_id = 3
public_review_platform
How many reviews made by user whose ID is 3 are long?
long refers to review_length = 'Long';
SELECT COUNT(review_length) FROM Reviews WHERE user_id = 3 AND review_length LIKE 'Long'
public_review_platform
Among the long reviews made by user ID 3, how many of them have received a medium number of useful votes?
long reviews refers to review_length = 'Long'; medium number of useful votes refers to review_votes_useful = 'medium';
SELECT COUNT(review_length) FROM Reviews WHERE user_id = 3 AND review_length LIKE 'Long' AND review_votes_useful LIKE 'Medium'
public_review_platform
How many users have joined Yelp since the year 2012?
since year 2012 refers to user_yelping_since_year = '2012'
SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year = 2012
public_review_platform
Please list the IDs of the users who have a high number of followers.
high number of followers refers to user_fans = 'High'
SELECT user_id FROM Users WHERE user_fans LIKE 'High' GROUP BY user_id
public_review_platform
How many Yelp_Businesses do not provide alcohol?
do not provide alcohol refers to attribute_name = 'Alcohol'and attribute_value = 'none'
SELECT COUNT(T1.attribute_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name LIKE 'Alcohol' AND T2.attribute_value LIKE 'none'
public_review_platform
Among the Yelp_Businesses in Arizona, how many of them do not provide alcohol?
Arizona refers to state = 'AZ'; do not provide alcohol refers to attribute_name = 'Alcohol' and attribute_value = 'none'
SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name LIKE 'Alcohol' AND T2.attribute_value LIKE 'none' AND T3.state LIKE 'AZ'
public_review_platform
How many Yelp_Business falls under the category of "Shopping"?
category of "Shopping" refers to category_name = 'Shopping'
SELECT COUNT(T1.category_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id WHERE T1.category_name LIKE 'Shopping'
public_review_platform
Under which categories is Yelp_Business no. 1?
categories refers to category_name; Yelp_Business no.1 refers to business_id = 1
SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id WHERE T2.business_id = 1
public_review_platform
Among the Yelp_Businesses which are still running, how many of them fall under the category of "Food"?
are still running refers to active = 'true'; the category of "Food" refers to category_name = 'Food'
SELECT COUNT(T3.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Tips AS T4 ON T3.business_id = T4.business_id WHERE T1.category_name LIKE 'Food' AND T3.active LIKE 'TRUE'
public_review_platform
How many Yelp_Business in Anthem are under the category of "Food"?
in Anthem refers to city = 'Anthem'; the category of "Food" refers to category_name = 'Food'
SELECT COUNT(T3.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.category_name LIKE 'Food' AND T3.city LIKE 'Anthem'
public_review_platform
Please list the business ID of the Yelp_Business with the highest Elitestar rating under the category "Food".
under the category "Food" refers to category_name = 'Food'
SELECT T2.business_id FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.category_name LIKE 'Food' ORDER BY T3.stars DESC LIMIT 1
public_review_platform
How many Yelp_Business under the category of "Food" are good for kids?
under the category of "Food" refers to category_name = 'Food'; are good for kids refers to attribute_name = 'Good for Kids' and attribute_value = 'true'
SELECT COUNT(T3.stars) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Business_Attributes AS T4 ON T3.business_id = T4.business_id INNER JOIN Attributes AS T5 ON T4.attribute_id = T5.attribute_id WHERE T1.category_name LIKE 'Food' AND T5.attribute_name LIKE 'Good for Kids' AND T4.attribute_value LIKE 'TRUE'
public_review_platform
How many Yelp_Business in Arizona has user no. 3 reviewed?
in Arizona refers to state = 'AZ'; user no. 3 refers to user_id = 3
SELECT COUNT(T2.business_id) FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T2.state LIKE 'AZ' AND T1.user_id = 3
public_review_platform
Please list all the categories of the Yelp_Business in Arizona.
categories refers to category_name; in Arizona refers to state = 'AZ'
SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.state LIKE 'AZ' GROUP BY T1.category_name
public_review_platform
How many Yelp_Business close after 8PM on Mondays?
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'
SELECT COUNT(T1.business_id) FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week LIKE 'Monday' AND T1.closing_time > '8PM'
public_review_platform
Among the Yelp_Business in Arizona, how many of them closes at 12PM on Sundays?
in Arizona refers to state = 'AZ'; closes at 12PM refers to closing_time = '12PM'; on Sundays refers to day_of_week = 'Sunday'
SELECT COUNT(T1.business_id) FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T2.day_of_week LIKE 'Sunday' AND T1.closing_time LIKE '12PM' AND T3.state LIKE 'AZ'
public_review_platform
Please list the categories of the Yelp_Business that closes at 12PM on Sundays.
categories refers to category_name; closes at 12PM refers to closing_time = '12PM'; on Sundays refers to day_of_week = 'Sunday'
SELECT T4.category_name FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business_Categories AS T3 ON T1.business_id = T3.business_id INNER JOIN Categories AS T4 ON T4.category_id = T4.category_id WHERE T1.closing_time = '12PM' AND T2.day_of_week = 'Sunday' GROUP BY T4.category_name
public_review_platform
How many "Good for Kids" Yelp_Businesses are open everyday of the week?
Good for Kids refers to attribute_name = 'Good for Kids'and attribute_value = 'true'; open everyday refers to day_id between 1 and 7
SELECT COUNT(T1.business_id) FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business_Attributes AS T3 ON T1.business_id = T3.business_id INNER JOIN Attributes AS T4 ON T4.attribute_id = T4.attribute_id WHERE T2.day_id IN (1, 2, 3, 4, 5, 6, 7) AND T4.attribute_name = 'Good for Kids' AND T3.attribute_value = 'true'
public_review_platform
How many users became an elite user the same year they joined Yelp?
became an elite user the same year they joined Yelp refers to user_yelping_since_year = year_id
SELECT COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = T2.year_id
public_review_platform
How many elite users have reviewed Yelp_Business no.1?
Yelp_Business no.1 refers to business_id = 1
SELECT COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id INNER JOIN Reviews AS T3 ON T1.user_id = T3.user_id WHERE T3.business_id = 1
public_review_platform
Which Yelp_Business in Arizona gets the most number of reviews?
Arizona refers to state = 'AZ'; gets the most number of reviews refers to max(count(Reviews.business_id))
SELECT T1.user_id FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T2.state LIKE 'AZ' GROUP BY T1.user_id ORDER BY COUNT(T1.user_id) DESC LIMIT 1
public_review_platform
How many stars on average does a Yelp_Business in Anthem get from a user review?
in Anthem refers to city = 'Anthem'; stars on average = avg(review_stars)
SELECT AVG(T2.review_stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Anthem'
public_review_platform
How many stars on average does user no.3 give to Yelp_Business in Arizona?
user no.3 refers to user_id = 3; in Arizona refers to state = 'AZ'; stars on average = avg(review_stars(user_id = 3))
SELECT AVG(T2.review_stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state LIKE 'AZ' AND T2.user_id = 3
public_review_platform
What is the average Elitestar rating for a Yelp_Business that closes at 12PM on Sundays?
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'
SELECT CAST(SUM(T3.stars) AS REAL) / COUNT(T1.business_id) AS "average stars" FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T2.day_of_week LIKE 'Sunday' AND T1.closing_time LIKE '12PM'
public_review_platform
How many of the busineses are in Casa Grande?
in Casa Grande refers to city = 'Casa Grande'
SELECT COUNT(city) FROM Business WHERE city LIKE 'Casa Grande'
public_review_platform
What is the total number of active businesses in AZ with a low review count?
active businesses refers to active = 'true'; in AZ refers to state = 'AZ'
SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND active LIKE 'True' AND review_count LIKE 'low'
public_review_platform
List down the business ID with a star range from 2 to 3, located at Mesa.
star range from 2 to 3 refers to stars > = 2 AND stars < 4;  located at Mesa refers to city = 'Mesa'
SELECT business_id FROM Business WHERE city LIKE 'Mesa' AND stars BETWEEN 2 AND 3
public_review_platform
In users yelping since 2011 to 2013, how many of them have high count of fans?
In users yelping since 2011 to 2013 refers to user_yelping_since_year > = 2011 AND user_yelping_since_year < 2014
SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year BETWEEN 2011 AND 2013 AND user_fans LIKE 'High'
public_review_platform
What is the review length of user 35026 to business with business ID 2?
user 35026 refers to user_id = 35026
SELECT review_length FROM Reviews WHERE user_id = 35026 AND business_id = 2
public_review_platform
Among the businesses in Chandler, list the attribute of the business with a low review count.
in Chandler refers to city = 'Chandler'; attribute refers to attribute_name
SELECT DISTINCT T3.attribute_id, T3.attribute_name FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.attribute_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.review_count = 'Low' AND T1.city = 'Chandler'
public_review_platform
In businesses with a category of mexican, how many of them has a star rating below 4?
category of mexican refers to category_name = 'Mexican'; star rating below 4 refers to stars < 4
SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.stars < 4 AND T3.category_name LIKE 'Mexican'
public_review_platform
What is the category of businesses with highest star rating?
category refers to category_name; highest star rating refers to max(stars)
SELECT T3.category_name FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id ORDER BY T1.stars DESC LIMIT 1
public_review_platform
What is the category of the business with medium review length and highest review stars within business ID from 6 t0 9?
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
SELECT T4.category_name FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T1.review_length LIKE 'Medium' AND T2.business_id BETWEEN 6 AND 9 ORDER BY T1.review_stars DESC LIMIT 1
public_review_platform
Count the active businesses that has an attribute of caters with low review count.
active businesses refers to active = 'true'; attribute of caters refers to attribute_name = 'Caters'
SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T3.attribute_name LIKE 'Caters' AND T1.review_count LIKE 'Low' AND T1.active LIKE 'TRUE'
public_review_platform
What is the closing and opening time of businesses located at Tempe with highest star rating?
located at Tempe refers to city = 'Tempe'; highest star rating refers to max(stars)
SELECT T2.closing_time, T2.opening_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Tempe' ORDER BY T1.stars DESC LIMIT 1
public_review_platform
Find the location of businesses that have business hours from 8 am to 9 pm every Friday.
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'
SELECT T1.city FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.closing_time LIKE '9PM' AND T2.opening_time LIKE '8AM' AND T3.day_of_week LIKE 'Friday' GROUP BY T1.city
public_review_platform
Among the businesses with a category of Accessories, what is the percentage of the business with less than 4 stars?
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%
SELECT CAST(SUM(CASE WHEN T1.stars < 4 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.stars) AS "percentage" FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T3.category_name LIKE 'Accessories'
public_review_platform
How many active businesses are located at Phoenix, Arizona?
active business refers to active = 'true'; 'Phoenix' is the city
SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Phoenix' AND active LIKE 'True'
public_review_platform
How many businesses are with high review count?
high review count refers to review_count = 'High'
SELECT COUNT(business_id) FROM Business WHERE review_count LIKE 'High'
public_review_platform
How many businesses ID sell beer and wine?
attribute_value = 'beer_and_wine'
SELECT COUNT(business_id) FROM Business_Attributes WHERE attribute_id = 1 AND attribute_value = 'beer_and_wine'
public_review_platform
How many attributes ID owned by business ID 2?
SELECT COUNT(attribute_id) FROM Business_Attributes WHERE business_id = 2
public_review_platform
How many users received high compliment type in photo?
high compliments refers to number_of_compliments = 'High'; type in photo refers to compliment_ID = 1
SELECT COUNT(T1.user_id) FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.number_of_compliments LIKE 'High' AND T2.compliment_id = 1
public_review_platform
How many businesses in Phoenix, Arizona is attributed to waiter service?
'Phoenix' is the city; waiter service refers to attribute_name = 'waiter_services'
SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.city LIKE 'Phoenix' AND T3.attribute_name LIKE 'waiter_service' AND T2.attribute_id = 2
public_review_platform
Which business in fashion category has the most review?
'Fashion' is the category_name; most review refers to Max(Count(user_id))
SELECT T3.business_id FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id INNER JOIN Reviews AS T4 ON T3.business_id = T4.business_id WHERE T1.category_name LIKE 'Fashion' AND T1.category_id = 7 GROUP BY T3.business_id ORDER BY COUNT(T4.user_id) DESC LIMIT 1
public_review_platform
List out which business category that are most likely to have average good review in Arizona?
average good review refers to review_count > = 3; Arizona refers to state = 'AZ'; business category refers to category_name
SELECT DISTINCT T4.category_name FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T2.state LIKE 'AZ' AND T1.review_stars >= 3
public_review_platform
Calculate the increment percentage of elite user for each year since year 2005.
since year 2005 refers to year_id Between 2005 and 2014; increment percentage = Divide(Count(user_id(year_id < 2014)), Count (user_id(year_id = 2015))) * 100
SELECT CAST(COUNT(CASE WHEN year_id < 2014 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(CASE WHEN year_id = 2005 THEN 1.0 ELSE NULL END) AS increment FROM Elite
public_review_platform
What is the average number of review received by each business given that the user is an elite?
average review = Divide(Count(user_id), Count(business_id))
SELECT CAST(COUNT(T1.user_id) AS REAL) / COUNT(DISTINCT T1.business_id) FROM Reviews AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id
public_review_platform
Find out which hotel and travel business having the most review? Calculate the standard deviation of the review star for this business.
"Hotel & Travel" is the category_name; most review refers to Max(Count(category_id)); Average star per user = Divide (Sum (review_stars), Count(user_id))
SELECT T2.category_id FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Reviews AS T3 ON T3.business_id = T1.business_id WHERE T2.category_name = 'Hotels & Travel' GROUP BY T2.category_id ORDER BY COUNT(T2.category_id) DESC LIMIT 1
public_review_platform
What is the correlation between the review starts and business stars?
highest review count refers to review_count = 'Uber'; average business review stars = Divide (Sum(review_stars), Count(user_id))
SELECT CAST(SUM(T2.review_stars) AS REAL) / COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id
public_review_platform
How many of the businesses are active?
active refers to active = 'true'
SELECT COUNT(business_id) FROM Business WHERE active LIKE 'True'
public_review_platform
List down the business ID with a low review count in Phoenix.
"Phoenix" is the city; low review count refers to review_count = 'Low'
SELECT business_id FROM Business WHERE city LIKE 'Phoenix' AND review_count LIKE 'Low'
public_review_platform
What is the total number of active business in AZ with a high review count?
active business refers to active = 'true'; 'AZ' is the state; high review count refers to review_count = 'High'
SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND review_count LIKE 'High' AND active LIKE 'True'
public_review_platform
List down the business ID with a star range from 3 to 4, located at Tempe.
star range from 3 to 4 refers to stars > = 3 AND stars < 5; 'Tempe' is the name of city
SELECT business_id FROM Business WHERE city LIKE 'Tempe' AND stars BETWEEN 3 AND 4
public_review_platform
In users yelping since 2010 to 2012, how many of them has an low fans?
user yelping since 2010 to 2012 refers to user_yelping_since_year > = '2010' AND user_yelping_since_year < '2013'; low fans refers to user_fans = 'Low'
SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year BETWEEN 2010 AND 2012 AND user_fans LIKE 'Low'
public_review_platform
What is the review length of user 60776 to business with business ID 1?
"60776" is the user_id
SELECT review_length FROM Reviews WHERE user_id = 60776 AND business_id = 1
public_review_platform
Among the businesses in Scottsdale, list the attribute of the business with a high review count.
"Scottsdale" is the name of city; high review count refers to review_count = 'High'; attribute of the business refers to attribute_name
SELECT T3.attribute_name FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.review_count LIKE 'High' AND T1.city LIKE 'Scottsdale' GROUP BY T3.attribute_name
public_review_platform
In businesses with a category of automotive, how many of them has an star rating below 3?
"Automotive" is the category of business; star rating below 3 refers to stars < 3
SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T3.category_name LIKE 'Automotive' AND T1.stars < 3
public_review_platform
What is the attribute of the business with highest star rating?
highest star rating Max(stars); attribute of business refers to attribute_name
SELECT T3.attribute_name FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id ORDER BY T1.stars DESC LIMIT 1
public_review_platform
What is the category of the business with short review length and highest review stars within business ID from 5 t0 10?
short review length refers to review_length = 'Short'; highest review stars refers to Max(review_stars); business ID from 5 to 10 refers to business_id BETWEEN 5 AND 10; category of business refers to category_name
SELECT T4.category_name FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T2.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T1.review_length LIKE 'Short' AND T2.business_id BETWEEN 5 AND 10 ORDER BY T1.review_stars DESC LIMIT 1
public_review_platform
Count the active businesses that has an attribute of Wi-Fi with medium review count.
active business refers to active = 'true'; 'Wi-Fi' is the attribute_name; medium review count refers to review_count = 'Medium'
SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T3.attribute_name LIKE 'Wi-Fi' AND T1.active LIKE 'TRUE' AND T1.review_count LIKE 'Medium'
public_review_platform
What is the closing and opening time of businesses located at Gilbert with highest star rating?
"Gilbert" is the name of city; highest star rating refers to Max(stars)
SELECT T2.closing_time, T2.opening_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Gilbert' ORDER BY T1.stars DESC LIMIT 1
public_review_platform
Among the active businesses located at Mesa, AZ, list the category and attributes of business with a low review count.
active business refers to active = 'true': 'Mesa' is the name of city; 'AZ' is the state; low review count refers to review_count = 'Low'; category refers to category_name
SELECT T3.category_name FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T1.review_count = 'Low' AND T1.city = 'Mesa' AND T1.active = 'true' AND T1.state = 'AZ'
public_review_platform
Find the location of businesses that has business hours from 9 am to 9 pm every Saturday.
9 am refers to opening_time = '9AM'; 9 pm refers to closing_time = '9PM'; every Saturday refers to day_of_week = 'Saturday'; location refers to city
SELECT T1.city FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.closing_time LIKE '9PM' AND T2.opening_time LIKE '9AM' AND T3.day_of_week LIKE 'Saturday' GROUP BY T1.city
public_review_platform
Among the businesses with a category of Local Services, what is the percentage of the business with less than 3 stars?
"Local Services" is the category_name; less than 3 stars refers to stars < 3; percentage = Divide(Count(business_id(stars < 3)), Count(business_id)) * 100
SELECT CAST(SUM(CASE WHEN T1.stars < 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.stars) AS "percentage" FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T3.category_name LIKE 'Local Services'
public_review_platform
How many users have no followers in 2014?
in 2004 refers to user_yelping_since_year = 2004; no follower refers to user_fans = 'None'
SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year = 2004 AND user_fans LIKE 'None'
public_review_platform
List at least 5 users that has received less than 5 low compliments from other users.
less than 5 low compliment refers to number_of_compliments < 5
SELECT user_id FROM Users_Compliments WHERE number_of_compliments LIKE 'Low' GROUP BY user_id ORDER BY COUNT(number_of_compliments) > 5 LIMIT 5
public_review_platform
What city does the business have a business hour from 10 am to 12 pm on Sunday?
10 am refers to opening_time = '10AM'; 12 pm refers to closing_time = '12PM'; on Sunday refers to day_of_week = 'Sunday'
SELECT T1.city FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.opening_time LIKE '10AM' AND T2.closing_time LIKE '12PM' AND T3.day_of_week LIKE 'Sunday'
public_review_platform
How many businesses are opened for 24 hours?
opened for 24 hours refers to attribute_name = 'Open 24 Hours' AND attribute_value = 'true'
SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_value LIKE 'TRUE' AND T1.attribute_name LIKE 'Open 24 Hours'
public_review_platform
List the category of the business with high review count but received 2 stars.
high review count refers to review_count = 'High'; received 2 stars refers to stars = 2; category refers to category_name
SELECT T3.category_name FROM Business AS T1 INNER JOIN Business_Categories ON T1.business_id = Business_Categories.business_id INNER JOIN Categories AS T3 ON Business_Categories.category_id = T3.category_id WHERE T1.stars = 2 AND T1.review_count LIKE 'High'
public_review_platform
How many businesses have a romantic ambiance?
romantic ambiance refers to attribute_name = 'ambience_romantic' AND attribute_value = 'true'
SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_value = 'true' AND T1.attribute_name = 'ambience_romantic'
public_review_platform
List the city of the business where they open from 1 pm to 6 pm on Saturday.
1 pm refers to opening_time = '1PM'; 6 pm refers to closing_time = '6PM'; on Saturday refers to day_of_week = 'Saturday'
SELECT T1.city FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.closing_time LIKE '6PM' AND T2.opening_time LIKE '1PM' AND T3.day_of_week LIKE 'Saturday'
public_review_platform
What is the total number of fans or followers who received most likes of their comments in the business?
fans and followers refers to user_fans; most likes of their comments refer to Max(likes)
SELECT COUNT(T1.user_fans) FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id ORDER BY COUNT(T2.likes) DESC LIMIT 1
public_review_platform
How many businesses have shopping centers and received high review count?
"Shopping Centers" is the category_name; high review count refers to review_count = 'High'
SELECT COUNT(T2.business_id) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.category_name = 'Shopping Centers' AND T3.review_count = 'High'
public_review_platform
How many businesses accept insurance?
business that accept insurance refers to attribute_name = 'Accepts Insurance' AND attribute_value = 'true'
SELECT COUNT(T1.business_id) FROM Business_Attributes AS T1 INNER JOIN Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_name = 'Accepts Insurance' AND T1.attribute_value = 'true'
public_review_platform
Calculate the average review star from users in businesses located in South Carolina and California state.
"South Carolina" and "California" are both state; average review stars from users = Divide((Sum(review_stars(state = 'SC')) + Sum(review_stars(state = 'CA'))), Sum(stars))
SELECT 1.0 * (( SELECT SUM(T1.stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state = 'SC' ) + ( SELECT SUM(T1.stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state = 'CA' )) / ( SELECT SUM(T1.stars) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id ) AS reslut
public_review_platform
Compare and get the difference of the number of businesses that are open in Monday and Tuesday from 10 am to 9 pm.
10 am refers to opening_time = '10AM'; 9 pm refers to closing_time = '9PM'; 'Monday' and 'Tuesday' are both day_of_week; difference number of business = Subtract(Count(business_id(day_of_week = 'Monday')), Count(business_id(day_of_week = 'Tuesday')))
SELECT SUM(CASE WHEN T3.day_of_week = 'Monday' THEN 1 ELSE 0 END) - SUM(CASE WHEN T3.day_of_week = 'Tuesday' THEN 1 ELSE 0 END) AS DIFF FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T2.opening_time = '10AM' AND T2.closing_time = '9PM'
public_review_platform
State the ID number for the attribute named "Accepts Insurance"?
ID number refers to attribute_id
SELECT attribute_id FROM Attributes WHERE attribute_name = 'Accepts Insurance'
public_review_platform
How many actively running Yelp businesses are there located in "Phoenix" city?
actively running business refers to active = 'true'; 'Phoenix' is the name of city
SELECT COUNT(business_id) FROM Business WHERE active = 'true' AND city = 'Phoenix'
public_review_platform
Give the number of "4" stars Yelp businesses in "Mesa" city.
"4" stars refers to stars = '4'; 'Mesa' is the name of city
SELECT COUNT(business_id) FROM Business WHERE stars = 4 AND city = 'Mesa'
public_review_platform
Provide the number of Yelp businesses in "Gilbert" which got a" high" review count.
"Gilbert" is the name of city; high review count refers to review_count = 'High'
SELECT COUNT(business_id) FROM Business WHERE review_count = 'High' AND city = 'Gilbert'
public_review_platform
Which actively running Yelp business in "Gilbert" has got the most reviews? Give the business id.
actively running business refers to active = 'true'; 'Gilbert' is the name of city; most review refers to review_count = 'Uber'
SELECT DISTINCT T1.business_id FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.active = 'true' AND T1.city = 'Gilbert' AND T1.review_count = 'Uber'
public_review_platform
For the Yelp business in "Tempe" city which got "3.5" stars and review count as "Uber", how many "long" reviews did it get?
"Tempe" is the name of city; long review refers to review_length = 'Long'
SELECT COUNT(T2.review_length) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Tempe' AND T1.stars = '3.5' AND T1.review_count = 'Uber' AND T2.review_length = 'Long'
public_review_platform
How is the "noise level" for the only Yelp business in “Mesa” which got a "Uber" review count?
"Noise Level" is the attribute_name; 'Mesa' is the name of city
SELECT T3.attribute_name FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Attributes AS T3 ON T2.attribute_id = T3.attribute_id WHERE T1.city = 'Mesa' AND T1.review_count = 'Uber' AND T3.attribute_name = 'Noise Level'
public_review_platform
Is the Yelp business No. 14033 good for supper?
business no. 14033 refers to business_id = 14033; good for supper refers to attribute_name = 'good_for_dinner'
SELECT T1.attribute_value FROM Business_Attributes AS T1 INNER JOIN Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_name = 'good_for_dinner' AND T1.business_id = 14033
public_review_platform
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.
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'
SELECT T1.business_id FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Phoenix' AND T2.review_stars = 5 AND T2.review_votes_funny = 'Uber'
public_review_platform
Which city is the business that got a "medium" length tip with "3" likes located in?
medium length tip refers to tip_length = 'Medium';
SELECT T1.city FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T2.tip_length = 'Medium' AND T2.likes = 3
public_review_platform
How many "cool" type compliments does user No. 41717 get?
"cool" type compliments refers to compliment_type = 'cool'; user No. 41717 refers to user_id = 41717
SELECT COUNT(T2.number_of_compliments) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'cool' AND T2.user_id = 41717