db_id
stringclasses
69 values
question
stringlengths
24
325
evidence
stringlengths
0
673
SQL
stringlengths
23
804
question_id
int64
0
9.43k
difficulty
stringclasses
1 value
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'
3,900
public_review_platform
How many attributes ID owned by business ID 2?
SELECT COUNT(attribute_id) FROM Business_Attributes WHERE business_id = 2
3,901
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
3,902
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
3,903
public_review_platform
Find out which business is opened for 24/7 and list out what is the business attribute.
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
SELECT T5.attribute_name 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 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 T2.day_id LIKE '1' AND '2' AND '3' AND '4' AND '5' AND '6' AND '7' AND T1.opening_time = T1.closing_time GROUP BY T5.attribute_name
3,904
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
3,905
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
3,906
public_review_platform
What is the ratio of having the best to worse elite user in 2013?
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)))
SELECT CAST(SUM(CASE WHEN T1.user_average_stars = 1 THEN 1 ELSE 0 END) AS REAL) / COUNT(T2.user_id) , SUM(CASE WHEN T1.user_average_stars = 5 THEN 1 ELSE 0 END) * 1.0 / COUNT(T2.user_id) FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id WHERE T2.year_id = 2013
3,907
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
3,908
public_review_platform
How many business have been reviewed by user ID 3 and how long have this user been with Yelp?
year with yelp = Subtract ('%Y'(CURRENT TIME), user_yelping_since_year)
SELECT COUNT(T1.business_id) , strftime('%Y', 'now') - T2.user_yelping_since_year FROM Reviews AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.user_id = 3
3,909
public_review_platform
What is the yearly average review done by user ID 3?
yearly average review = Divide( Count(business_id), Subtract('%Y'(CURRENT_TIME), user_yelping_since_year))
SELECT COUNT(review_stars) / (strftime('%Y', 'now') - T1.user_yelping_since_year) FROM Users AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id WHERE T1.user_id = 3
3,910
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
3,911
public_review_platform
List out the user who is an elite user for consecutively 5 years or more and what is the user average star? How many likes does this user gets?
elite user for consecutively 5 years or more refers to user_id COUNT(year_id) > 5; Average star = AVG(likes)
SELECT T2.user_average_stars, COUNT(T3.likes) FROM Elite AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id INNER JOIN Tips AS T3 ON T3.user_id = T2.user_id GROUP BY T1.user_id HAVING COUNT(T1.user_id) > 5
3,912
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
3,913
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
3,914
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'
3,915
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'
3,916
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'
3,917
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
3,918
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'
3,919
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
3,920
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
3,921
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
3,922
public_review_platform
List the active business ID and its stars of the businesses fall under the category of Pets.
active business refers to active = 'true'; 'Pets' is the category_name
SELECT T1.business_id, T1.stars 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.active LIKE 'TRUE' AND T3.category_name LIKE 'Pets'
3,923
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
3,924
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
3,925
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'
3,926
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
3,927
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'
3,928
public_review_platform
List the categories of inactive businesses in AZ.
inactive business refers to active = 'FALSE'; 'AZ' is the state; 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.active LIKE 'FALSE' AND T1.state LIKE 'AZ'
3,929
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
3,930
public_review_platform
What is the attribute value of an inactive business with a medium review count and 3.5 stars which is located at Phoenix, AZ?
inactive business refers to active = 'FALSE'; 'AZ' is the state; 'Phoenix' is the name of city; medium review count refers to review_count = 'Medium'; 3.5 stars refers to stars = 3.5
SELECT T2.attribute_value 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.state LIKE 'AZ' AND T1.review_count LIKE 'Medium' AND T1.active LIKE 'FALSE' AND T1.city LIKE 'Phoenix' AND T1.stars = 3.5
3,931
public_review_platform
What is the opening time of the active businesses in Surprise that has a low review count.
active business refers to active = 'true'; 'Surprise' is the name of city;  low review count refers to review_count = 'Low'
SELECT T2.opening_time 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 T1.city LIKE 'Surprise' AND T1.active LIKE 'TRUE' AND T1.review_count LIKE 'Low' GROUP BY T2.opening_time
3,932
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'
3,933
public_review_platform
List the closing time and day of week of active businesses in Scottsdale with stars greater than the 60% of average age of star rating.
active business refers to active = 'true';  'Scottsdale' is the name of city; stars greater than the 60% of average age of star rating refers to stars  > avg(stars) * 60%
SELECT T2.closing_time, T3.day_of_week 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 T1.city LIKE 'Scottsdale' AND T1.active LIKE 'TRUE' AND T1.stars > 0.6 * ( SELECT AVG(T1.stars) 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 T1.city LIKE 'Scottsdale' AND T1.active LIKE 'TRUE' )
3,934
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'
3,935
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
3,936
public_review_platform
List at least 10 users ID that has 4 as an average ratings of all reviews sent.
4 as an average rating refers to user_average_stars = 4
SELECT COUNT(user_id) FROM Users WHERE user_average_stars = 4 LIMIT 10
3,937
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'
3,938
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'
3,939
public_review_platform
List at least 5 active business ID that are good for groups and dancing.
"Good for Groups" and "Good for Dancing" are attribute_name; active business refers to active = true'
SELECT 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 T2.attribute_value LIKE 'TRUE' AND T1.attribute_name LIKE 'Good for Dancing' AND T1.attribute_name LIKE 'Good for Groups' LIMIT 5
3,940
public_review_platform
Among the active businesses in Ahwatukee, which of them are still open in Sunday?
active business refers to active = 'true'; 'Ahwatukee' is the name of city; open in Sunday refers to day_of_week = 'Sunday'
SELECT T1.business_id 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 T1.city LIKE 'Ahwatukee' AND T1.active LIKE 'TRUE' AND T3.day_of_week LIKE 'Sunday'
3,941
public_review_platform
List the categories of all active businesses that were not in Arizona.
active business refers to active = 'true'; not in Arizona refers to state ! = 'AZ'; 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.active LIKE 'TRUE' AND T1.state NOT LIKE 'AZ'
3,942
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'
3,943
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'
3,944
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'
3,945
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
3,946
public_review_platform
What city does the business came from where they received a high volume of check-ins from 12 am to 1 am on Saturday.
12 am refers to opening_time = '12AM'; 1 am refers to closing_time = '1AM'; 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 = '1AM' AND T2.opening_time = '12AM' AND T3.day_of_week = 'Saturday'
3,947
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'
3,948
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'
3,949
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
3,950
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'
3,951
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'
3,952
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'
3,953
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'
3,954
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'
3,955
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'
3,956
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'
3,957
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'
3,958
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
3,959
public_review_platform
How long is the Yelp business No. 15098 opened on Monday?
Yelp business No. 15098 refers to business_id = '15098'; Monday refers to day_of_week = 'Monday'
SELECT SUBSTR(T1.closing_time, 1, 2) + 12 - SUBSTR(T1.opening_time, 1, 2) AS YYSJ FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week = 'Monday' AND T1.business_id = 15098
3,960
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'
3,961
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
3,962
public_review_platform
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?
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'
SELECT COUNT(T2.user_id) FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id INNER JOIN Compliments AS T3 ON T2.compliment_id = T3.compliment_id WHERE T1.user_yelping_since_year = 2010 AND T1.user_average_stars = 4.5 AND T1.user_fans = 'Uber' AND T3.compliment_type = 'funny'
3,963
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
3,964
public_review_platform
Does Yelp business No."11825" have a "parking lot"?
business No."11825" refers to business_id = '12476'; have a "parking lot" refers to attribute_value = 'parking_lot'
SELECT T1.attribute_value FROM Business_Attributes AS T1 INNER JOIN Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.business_id = 11825 AND T2.attribute_name = 'parking_lot'
3,965
public_review_platform
Is the payment in mastercard possible for the Yelp business No."12476"?
Yelp business No."12476" refers to business_id = '12476'; payment in mastercard refers to attribute_value = 'payment_types_mastercard'
SELECT T1.attribute_value FROM Business_Attributes AS T1 INNER JOIN Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.business_id = 12476 AND T2.attribute_name = 'payment_types_mastercard'
3,966
public_review_platform
What is the percentage for the Yelp businesses in "Pets" category of all businesses?
businesses in "Pets" category refers to category_name = 'Pets'; percentage refers to DIVIDE(COUNT(category_name = 'Pets'), COUNT(business_id)) * 100%
SELECT CAST(SUM(CASE WHEN T2.category_name = 'Pets' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.category_name) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id
3,967
public_review_platform
How many times is the number of "Women's Clothing" Yelp businesses to "Men's Clothing"?
"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'))
SELECT CAST(SUM(CASE WHEN T2.category_name = 'Women''s Clothing' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.category_name = 'Men''s Clothing' THEN 1 ELSE 0 END) AS TIMES FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id
3,968
public_review_platform
Write down the ID, active status and city of the business which are in CA state.
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
SELECT business_id, active, city FROM Business WHERE state = 'CA' AND active = 'true'
3,969
public_review_platform
Calculate the percentage of running business among all business.
running business refers to active = 'true'; percentage refers to DIVIDE(COUNT(active = 'true'), COUNT(business_id)) * 100%
SELECT CAST(SUM(CASE WHEN active = 'true' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(business_id) FROM Business
3,970
public_review_platform
Among all attribute names, list down the ID and attribute name which start with "music".
attribute name which start with "music" refers to attribute_name LIKE 'music%'
SELECT attribute_id, attribute_name FROM Attributes WHERE attribute_name LIKE 'music%'
3,971
public_review_platform
Between 2006 and 2007, which year ID had the greater number in elite user?
2006 and 2007 refers to BETWEEN 2006 AND 2007; greater number in elite user refers to count(user_id)
SELECT year_id FROM Elite WHERE year_id IN (2006, 2007) GROUP BY year_id ORDER BY COUNT(user_id) DESC LIMIT 1
3,972
public_review_platform
Based on all user compliments, find the percentage of low number of compliments on all compliments ID.
low number of compliments refers to number_of_compliments = 'Low'; percentage refers to DIVIDE(COUNT(number_of_compliments = 'Low'), COUNT(user_id)) * 100
SELECT CAST(SUM(CASE WHEN number_of_compliments = 'Low' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(user_id) FROM Users_compliments
3,973
public_review_platform
List down the business ID and user ID who got uber for cool votes.
got uber for cool votes refers to review_votes_cool = 'Uber'
SELECT business_id, user_id FROM Reviews WHERE review_votes_cool = 'Uber'
3,974
public_review_platform
Write the user ID, business ID and tips length of who started using Yelp since 2004 and had high followers.
started using Yelp since 2004 refers to user_yelping_since_year = '2004'; had high followers refers to user_fans = 'High'
SELECT T1.user_id, T2.business_id, T2.tip_length FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2004 AND T1.user_fans = 'High'
3,975
public_review_platform
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.
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
SELECT T1.business_id, T1.active, T3.user_id, T3.user_yelping_since_year FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T2.review_votes_cool = 'Uber' AND T2.review_votes_funny = 'Uber' AND T2.review_length = 'Long'
3,976
public_review_platform
Under the attribute name of "music_playlist", describe the attribute ID, business ID, city and inactive status.
active status refers to active; active = 'true' means the business is still running; active = 'false' means the business is inactive or not running now
SELECT T1.attribute_id, T2.business_id, T3.city 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 = 'music_playlist' AND T3.active = 'false'
3,977
public_review_platform
Calculate the percentage of business with attribute name of "Accepts Credit Cards".
percentage refers to DIVIDE(COUNT(attribute_name = 'Accepts Credit Cards'), COUNT(business_id))*100%
SELECT CAST(SUM(CASE WHEN T1.attribute_name = 'Accepts Credit Cards' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.attribute_name) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id
3,978
public_review_platform
Among the stopped businesses in San Tan Valley city, list down the user ID and review length of who had great experience.
stop businesses refers to active = 'false'; great experience refers to review_stars = 5
SELECT T2.user_id, T2.review_length FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'San Tan Valley' AND T1.active = 'false' AND T2.review_stars = 5
3,979
public_review_platform
Mention the user average star, elite year and the compliment type of user ID 6027 whereby number of compliments reach uber.
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
SELECT T2.user_average_stars, T1.year_id, T4.compliment_type, T3.number_of_compliments FROM Elite AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id INNER JOIN Users_Compliments AS T3 ON T2.user_id = T3.user_id INNER JOIN Compliments AS T4 ON T3.compliment_id = T4.compliment_id INNER JOIN Years AS T5 ON T1.year_id = T5.year_id WHERE T3.number_of_compliments = 'Uber' AND T3.user_id = 6027
3,980
public_review_platform
Under the category name of "Coffee & Tea", mention any 5 business ID , their state and city.
SELECT T2.business_id, T3.state, T3.city 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 = 'Coffee & Tea' LIMIT 5
3,981
public_review_platform
Describe category name which had above 10% in comparing with all business and categories.
above 10% refers to DIVIDE(COUNT(Business_Categories.business_id = category_id), COUNT(category_id)) * 100% > 10%
SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id GROUP BY T2.category_id HAVING COUNT(T2.business_id) > ( SELECT COUNT(T3.business_id) FROM Business_Categories AS T3 ) * 0.1
3,982
public_review_platform
For the business with great experience existed in Sun Lakes city, provide the user ID who gave review on it and user followers.
with great experience refers to stars = 5
SELECT T3.user_id, T3.user_fans FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T1.city = 'Sun Lakes' AND T1.stars = 5
3,983
public_review_platform
Compare the number of business between the category of "Men's Clothing" and "Women's Clothing".
category of "Men's Clothing" refers to category_name = 'Men''s Clothing'; "Women's Clothing" refers to category_name = 'Women''s Clothing'
SELECT SUM(CASE WHEN T1.category_name = 'Men''s Clothing' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.category_name = 'Women''s Clothing' THEN 1 ELSE 0 END) AS diff FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id
3,984
public_review_platform
Among highest quality user of under ID 100, mention compliment type which got highest compliment number and user's followers.
highest quality user refers to number_of_compliments = 'Uber'; user of under ID 100 refers to user_id < 100 ;
SELECT T1.compliment_type, T3.user_fans FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T2.number_of_compliments = 'Uber' AND T2.user_id < 100
3,985
public_review_platform
List all the businesses that closed at 8PM.
closed at 8PM refers to closing_time = '8PM';
SELECT DISTINCT business_id FROM Business_Hours WHERE closing_time = '8PM'
3,986
public_review_platform
How many 2 stars rated business located in Phoenix, Arizona?
located in Phoenix refers to city = 'Phoenix'; Arizona refers to state = 'AZ'
SELECT COUNT(business_id) FROM Business WHERE city = 'Phoenix' AND state = 'AZ' AND stars = 2
3,987
public_review_platform
How many businesses in Tempe are rated as 'Wonderful experience?
in Tempe refers to city = 'Tempe'; rated as 'Wonderful experience refers to stars > 3
SELECT COUNT(business_id) FROM Business WHERE city = 'Phoenix' AND stars > 3
3,988
public_review_platform
List all the users with average star less than 3 stars in 2012
average star less than 3 stars refers to user_average_stars < 3; in 2012 refers to user_yelping_since_year = 2012
SELECT user_id FROM Users WHERE user_yelping_since_year = 2012 AND user_average_stars < 3
3,989
public_review_platform
Find the percentage of 5 stars rated business.
percentage refers to DIVIDE(COUNT(stars = 5), COUNT(business_id)) * 100%
SELECT CAST(SUM(CASE WHEN stars = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(stars) FROM Business
3,990
public_review_platform
Calculate difference between business that have the highest number of reviews and business that have the lowest number of reviews.
highest number of reviews refers to SUBTRACT(MAX(COUNT(business_id), MIN(COUNT(business_id))))
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
3,991
public_review_platform
List all the tires businesses that are opened everyday.
tires businesses refers to category_name = 'Tires'; opened everyday refers to COUNT(distinct opening_time) = 7;
SELECT DISTINCT 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 INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T1.category_name = 'Tires' GROUP BY T2.business_id HAVING COUNT(day_id) = 7
3,992
public_review_platform
Which users become an elite in 2012?
in 2012 refers to actual_year = 2012;
SELECT DISTINCT T1.user_id FROM Elite AS T1 INNER JOIN Years AS T2 ON T1.year_id = T2.year_id WHERE T2.actual_year = 2012
3,993
public_review_platform
List the business ID of shopping business that have 4 stars ratings.
shopping business refers to category_name = 'Shopping'; 4 stars ratings refers to stars = 4
SELECT T1.business_id 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 T3.category_name = 'Shopping' AND T1.stars = 4
3,994
public_review_platform
How many business have low check-in on Sunday at 10AM?
on Sunday refers to day_of_week = 'Sunday'; low check-in at 10AM refers to label_time_10 = 'Low'
SELECT COUNT(T2.business_id) FROM Days AS T1 INNER JOIN Checkins AS T2 ON T1.day_id = T2.day_id WHERE T1.day_of_week = 'Sunday' AND T2.label_time_10 = 'Low'
3,995
public_review_platform
How many businesses in Glendale are reviewed by user with the ID of 20241?
in Glendale refers to city = 'Glendale'
SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Glendale' AND T2.user_id = 20241
3,996
public_review_platform
State the locations of all Pet Services business.
location refers to city; Pet Services business refers to category_name = 'Pet Services'
SELECT T1.city 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 T3.category_name = 'Pet Services'
3,997
public_review_platform
How many photos type compliment given from users with high cool votes?
photos type compliment refers to compliment_type = 'photos'; high cool votes refers to review_votes_cool = 'High'
SELECT COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id INNER JOIN Compliments AS T3 ON T2.compliment_id = T3.compliment_id INNER JOIN Reviews AS T4 ON T1.user_id = T4.user_id WHERE T3.compliment_type = 'photos' AND T4.review_votes_cool = 'High'
3,998
public_review_platform
How many closed businesses that have more than 10 attributes?
closed refers to active = 'false'; more than 10 attributes refers to count(attribute_id) > 10
SELECT COUNT(*) FROM Business WHERE business_id IN ( SELECT T1.business_id FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T1.active = 'false' GROUP BY T1.business_id HAVING COUNT(DISTINCT T2.attribute_id) > 10 )
3,999