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
List the business located in Mesa that have alcohol attribute.
in Mesa refers to city = 'Mesa'; alcohol attribute refers to attribute_name = 'Alcohol'
SELECT 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 = 'Mesa' AND T3.attribute_name = 'Alcohol'
4,000
public_review_platform
Based on business in Phoenix, calculate the percentage of business with low funny votes.
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'
SELECT CAST(SUM(CASE WHEN T2.review_votes_funny = 'Low' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Phoenix'
4,001
public_review_platform
What is the ratio between business in shopping category and business in pets category?
ratio = divide(count(business_id where category_name = 'Shopping'), count(business_id where category_name = 'Pets'))
SELECT CAST(SUM(CASE WHEN T2.category_name = 'Shopping' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T2.category_name = 'Pets' THEN 1 ELSE 0 END) AS radio FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id
4,002
public_review_platform
How many businesses are registered in the database under 'Banks & Credit Unions' category?
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 WHERE T1.category_name = 'Banks & Credit Unions'
4,003
public_review_platform
How many active businesses from Casa Grande are registered in the database?
active business refers to active = 'true'; Casa Grande refers to city = 'Casa Grande'
SELECT COUNT(business_id) FROM Business WHERE active = 'true' AND city = 'Casa Grande'
4,004
public_review_platform
What time does the business with ID no.12 open on Monday?
open time refers to opening_time; on Monday refers to day_of_week = 'Monday'; business with ID no. refers to business_id
SELECT T1.opening_time FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T1.business_id = 12 AND T2.day_of_week = 'Monday'
4,005
public_review_platform
How many businesses that are registered in the database can be attributed to 'Good for Kids'?
can be attributed to 'Good for Kids' refers to attribute_name = 'Good for Kids' 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 T1.attribute_name = 'Good for Kids' AND T2.attribute_value = 'true'
4,006
public_review_platform
Identify the most popular and appealing active business in Gilbert based on users' reviews.
most popular and appealing refers to review_count = 'High' and max(stars); active business refers to active = 'true'; in Gilbert refers to city = 'Gilbert'
SELECT business_id FROM Business WHERE city = 'Gilbert' AND active = 'true' AND review_count = 'High' ORDER BY stars DESC LIMIT 1
4,007
public_review_platform
Find the 5-star business in Ahwatukee, AZ and identify it's business category.
5-star refers to stars = 5; in Ahwatukee refers to city = 'Ahwatukee'; business category refers to category_name
SELECT T1.business_id, 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.city = 'Ahwatukee' AND T1.stars = 5
4,008
public_review_platform
Among all closed businesses in Avondale, AZ what percent have obtained a 'wonderful experience' rating of the business.
closed business refers to active = 'false'; in Avondale refers to city = 'Avondale'; 'wonderful experience' rating refers to stars > 3; percentage = divide(count(business_id where stars > 3), count(business_id))*100%
SELECT CAST(SUM(CASE WHEN stars > 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(stars) FROM Business WHERE city = 'Avondale' AND active = 'false'
4,009
public_review_platform
Identify the user who has been yelping since 2004. Is he or she an Yelp Elite member?
has been yelping since 2004 refers to user_yelping_since_year = 2004
SELECT DISTINCT T2.user_id FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2004
4,010
public_review_platform
Identify the percent of long reviews among all 5-star reviews given to businesses by the Yelp users.
percentage = divide(count(business_id where review_length = 'Long' and review_stars = 5), count(business_id)) * 100%; long reviews refers to review_length = 'Long'; 5-star review refers to review_stars = 5
SELECT CAST(SUM(CASE WHEN review_length = 'Long' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(review_length) FROM Reviews WHERE review_stars = 5
4,011
public_review_platform
Among all the users with the average ratings of at least 4 and above of all reviews, calculate the percent that have no fans or followers.
average ratings of at least 4 refers to user_average_stars > = 4; no fans or followers refers to user_fans = 'None'; percentage = divide(count(user_id where user_average_stars > = 4 and user_fans = 'None'), sum(user_id where user_average_stars > = 4))*100%
SELECT CAST(SUM(CASE WHEN user_fans = 'None' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(user_id) FROM Users WHERE user_average_stars >= 4
4,012
public_review_platform
How many short tips were left for the business with ID no.2?
short tip refers to tip_length = 'Short'; business category refers to category_name
SELECT COUNT(business_id) FROM Tips WHERE business_id = 2 AND tip_length = 'Short'
4,013
public_review_platform
Find the Yelp user with the average 5-star rating of all reviews who has been yelping the longest.
Yelp user refers to user_id; average 5-star rating refers to user_average_stars = 5; yelping the longest refers to min(user_yelping_since_year)
SELECT user_id FROM Users WHERE user_average_stars = 5 ORDER BY user_yelping_since_year ASC LIMIT 1
4,014
public_review_platform
Identify the operating hours of businesses in Black Canyon City with review count greater than average.
operating hours refers to opening_time closing_time on day_id; in Black Canyon City refers to city = 'Black Canyon City'; greater than average refers to review_count > AVG(T1.review_count)
SELECT T2.opening_time, T2.closing_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 = 'Black Canyon City' GROUP BY t2.business_id HAVING T1.review_count > AVG(T1.review_count)
4,015
public_review_platform
Among all the users who received the high number of compliments, what percent received the 'cute' type of compliment.
high number of compliments refers to number_of_compliments = 'High'; percentage = divide(count(user_id where compliment_type = 'cute'), count(user_id))*100%
SELECT CAST(SUM(CASE WHEN T1.compliment_type = 'cute' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.user_id) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T2.number_of_compliments = 'High'
4,016
public_review_platform
Mention the number of businesses that have no any attribute.
have no attribute refers to attribute_value in( 'none', 'no', 'false')
SELECT COUNT(business_id) FROM Business_Attributes WHERE attribute_value IN ('none', 'no', 'false')
4,017
public_review_platform
What are the opening and closing time of business id 1 for day id 2?
false
SELECT opening_time, closing_time FROM Business_Hours WHERE business_id = 1 AND day_id = 2
4,018
public_review_platform
List out city name of businesses which have medium length of review.
medium length of review refers to review_length = 'Medium'
SELECT DISTINCT T1.city FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T2.review_length = 'Medium'
4,019
public_review_platform
What is the closing time of business id 4 on Sunday?
on Sunday refers to day_of_week = 'Sunday'
SELECT T2.closing_time FROM Days AS T1 INNER JOIN Business_Hours AS T2 ON T1.day_id = T2.day_id WHERE T1.day_of_week = 'Sunday' AND T2.business_id = 4
4,020
public_review_platform
Among the businesses which have short length of review, which one located in Phoenix?
short length of review refers to review_length = 'Short'; in Phoenix refers to city = 'Phoenix'
SELECT DISTINCT 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_length = 'Short'
4,021
public_review_platform
Among the users whose fan is medium, how many users received high compliments from other users.
is medium refers to user_fans = 'Medium'; high compliments refers to number_of_compliments = 'High'
SELECT COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id WHERE T2.number_of_compliments = 'High' AND T1.user_fans = 'Medium'
4,022
public_review_platform
Among the users who received low compliments from other users, which users joined Yelp in 2012?
low compliments refers to number_of_compliments = 'Low'; joined Yelp in 2012 refers to user_yelping_since_year = 2012
SELECT DISTINCT T2.user_id FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2012 AND T2.number_of_compliments = 'Low'
4,023
public_review_platform
Among the businesses without attribute, how many businesses located in Gilbert?
without attribute refers to attribute_value = 'None'; in Gilbert refers to city = 'Gilbert'
SELECT COUNT(T2.business_id) FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T2.city = 'Gilbert' AND T1.attribute_value IN ('None', 'no', 'false')
4,024
public_review_platform
Among the businesses with average rating, how many business has attribute of full_bar.
average rating refers to avg(stars); attribute of full_bar refers to attribute_value = 'full_bar'
SELECT COUNT(T1.business_id) FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.attribute_value = 'full_bar'
4,025
public_review_platform
List out the state of businesses which have opening time at 1AM.
state refers to city
SELECT DISTINCT T1.state FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T2.opening_time = '1AM'
4,026
public_review_platform
List out the category name of business id 5.
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 = 5
4,027
public_review_platform
List out the user id that has compliment type of photos.
compliment type of photos refers to compliment_type = 'photos'
SELECT T2.user_id FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'photos'
4,028
public_review_platform
Calculate the percentage of medium tip length in the list. List out the time when users of medium tip length join Yelp.
medium tip length refers to tip_length = 'Medium'; percentage = divide(count(tips where tip_length = 'Medium'), count(tips))*100%; the time when users join Yelp refers to user_yelping_since_year
SELECT CAST(SUM(CASE WHEN T1.tip_length = 'Medium' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.tip_length), T2.user_yelping_since_year FROM Tips AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id
4,029
public_review_platform
Calculate the percentage of businesses who located in Mesa. What is attribute value of these businesses.
percentage = divide(count(business where city = 'Mesa'), count(business)) * 100%
SELECT CAST(COUNT(T1.city) AS REAL) * 100 / ( SELECT COUNT(business_id) FROM Business ), T2.attribute_value FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Mesa'
4,030
public_review_platform
State the state of businesses which have closing time at 12AM.
state refers to city
SELECT DISTINCT T1.state FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T2.closing_time = '12AM'
4,031
public_review_platform
Among the businesses which have attribute of beer_and_wine, how many business located in Peoria?
attribute of beer_and_wine refers to attribute_value = 'beer_and_wine'; in Peoria refers to city = 'Peoria'
SELECT COUNT(T1.business_id) FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T2.city = 'Peoria' AND T1.attribute_value = 'beer_and_wine'
4,032
public_review_platform
Among the users who received high compliments from other users, which users joined Yelp earliest?
high compliments refers to number_of_compliments = ' High'; joined Yelp earliest refers to min(user_yelping_since_year)
SELECT T2.user_id FROM Users AS T1 INNER JOIN Users_Compliments AS T2 ON T1.user_id = T2.user_id WHERE T2.number_of_compliments = 'High' AND T1.user_yelping_since_year = ( SELECT MIN(user_yelping_since_year) FROM Users )
4,033
public_review_platform
Which business ID has the most reviews?
the most reviews refer to MAX(user_id);
SELECT business_id FROM Reviews GROUP BY business_id ORDER BY COUNT(user_id) DESC LIMIT 1
4,034
public_review_platform
Which year has the most elite users?
year has the most elite users refers to year_id with MAX(user_id);
SELECT year_id FROM Elite GROUP BY year_id ORDER BY COUNT(user_id) DESC LIMIT 1
4,035
public_review_platform
How many 5 star businesses have uber review votes for funny?
businesses refer to business_id; review_stars = 5.0; review_votes_funny = 'uber';
SELECT COUNT(business_id) FROM Reviews WHERE review_stars = 5 AND review_votes_funny = 'Uber'
4,036
public_review_platform
How many users have uber review votes for funny from the fans?
users refer to user_id; review_votes_funny = 'uber';
SELECT COUNT(DISTINCT user_id) FROM Reviews WHERE review_votes_funny = 'Uber'
4,037
public_review_platform
Which business ID have the shortest business operating hours?
the shortest business operating hours refer to MIN(SUBTRACT(closing_time, opening_time));
SELECT business_id FROM Business_Hours ORDER BY closing_time - opening_time LIMIT 1
4,038
public_review_platform
Find out which business ID are opened all the time.
opened all the time refers to Business_Hours where day_id BETWEEN 1 and 7 and opening_time = closing_time;
SELECT DISTINCT business_id FROM Business_Hours WHERE day_id >= 1 AND day_id < 8 AND opening_time = closing_time
4,039
public_review_platform
Does the length of the tip influence the number of likes for hotel and travel business category?
the longer the tip_length, the lesser the likes OR the longer the tip length the higher the likes; hotel and travel business category refers to category_name = 'Hotels & Travel';
SELECT T3.tip_length, SUM(T3.likes) AS likes FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Tips AS T3 ON T2.business_id = T3.business_id WHERE T1.category_name = 'Hotels & Travel' GROUP BY T3.tip_length
4,040
public_review_platform
How many users manage to get uber votes for all of the review category? Find out what are the user average star.
users refer to user_id; uber votes for all of the review category refer to review_votes_funny = 'uber' AND review_votes_useful = 'uber' AND review_votes_cool = 'uber';
SELECT COUNT(T2.user_id) AS USER_IDS, T2.user_average_stars FROM Reviews AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.review_votes_funny = 'Uber' AND T1.review_votes_useful = 'Uber' AND T1.review_votes_cool = 'Uber'
4,041
public_review_platform
What is the ratio of good to bad business star for a businesses that are opened all the time?
opened all the time refers to Business_Hours where day_id BETWEEN 1 and 7 and opening_time = closing_time; ratio can be computed as DIVIDE(COUNT(stars BETWEEN 3.5 and 5), COUNT(stars BETWEEN 1 and 2.5));
SELECT CAST(SUM(CASE WHEN T1.stars BETWEEN 3.5 AND 5 THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN T1.stars BETWEEN 1 AND 2.5 THEN 1 ELSE 0 END) AS ratio FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id
4,042
public_review_platform
List out 10 business ID that are being reviewed the most by users and list out what are top 3 business categories.
being reviewed the most refers to MAX(user_id); business categories refer to category_name;
SELECT T2.business_id, T3.category_name FROM Reviews 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 GROUP BY T2.business_id ORDER BY COUNT(T1.user_id) DESC LIMIT 10
4,043
public_review_platform
How many businesses in Arizona having an average review less than 3 stars?
businesses in Arizona refer to business_id where state = 'Arizona'; average review less than 3 stars refers to AVG(review_stars) < 3.0;
SELECT COUNT(business_id) FROM Business WHERE business_id IN ( SELECT DISTINCT T1.business_id FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.state = 'AZ' GROUP BY T1.business_id HAVING SUM(T2.review_stars) / COUNT(T2.user_id) < 3 )
4,044
public_review_platform
What is the percentage of user not becoming an elite user?
DIVIDE(SUBTRACT(COUNT(user_id), COUNT(Elite.user_id)), COUNT(user_id)) as percentage;
SELECT CAST((( SELECT COUNT(user_id) FROM Users ) - ( SELECT COUNT(DISTINCT user_id) FROM Elite )) AS REAL) * 100 / ( SELECT COUNT(user_id) FROM Users )
4,045
public_review_platform
What are the most common compliments types received by user with uber number of fans?
the most common compliments types refer to MAX(COUNT(compliment_id)); user_fans = 'uber';
SELECT DISTINCT T3.compliment_type 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_fans = 'Uber'
4,046
public_review_platform
What is the average year needed by a user with uber fans to become an elite user?
AVG(user_yelping_since_year) where user_fans = 'uber';
SELECT CAST(SUM(T2.year_id - T1.user_yelping_since_year) AS REAL) / COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id WHERE T1.user_fans = 'Uber'
4,047
public_review_platform
What is the average year for a user to be upgraded to elite user?
AVG(user_yelping_since_year) where user_id from Elite;
SELECT CAST(SUM(T2.year_id - T1.user_yelping_since_year) AS REAL) / COUNT(T1.user_id) FROM Users AS T1 INNER JOIN Elite AS T2 ON T1.user_id = T2.user_id
4,048
public_review_platform
How many business are opened for more than 8 hour in Mesa and what is the percentage of the active businesses?
business are opened for more than 8 hours refer to business_id where SUBTRACT(closing_time, opening_time) > 8; DIVIDE(COUNT(business_id where active = 'true' and city = 'Mesa' and SUBTRACT(closing_time, opening_time) > 8), COUNT(business_id where city = 'Mesa' and SUBTRACT(closing_time, opening_time) > 8)) as percentage;
SELECT CAST(SUM(CASE WHEN T1.active = 'true' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.business_id) AS ACT FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Mesa'
4,049
public_review_platform
How many active businesses are opened during late afternoon in the Phoenix city? List out the top 3 categories name for these businesses.
opened during late afternoon refers to Business_Hours where opening_time ≥ '5PM'; active businesses refer to business_id where active = 'true';
SELECT DISTINCT T4.category_name FROM Business_Hours 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.active = 'true' AND T2.city = 'Phoenix' AND T1.opening_time >= '5PM' LIMIT 3
4,050
public_review_platform
Which user has done the most review on a business attributed to delivery?
the most reviews refer to MAX(business_id) where attribute_name = 'Delivery';
SELECT T3.user_id FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Reviews AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name = 'Delivery' GROUP BY T3.user_id ORDER BY COUNT(T2.business_id) DESC LIMIT 1
4,051
public_review_platform
What is the average number of reviews written for active businesses that operate not more than 30 hours a week?
avg(user_id) where active = 'true' and SUM(SUBTRACT(closing_time, opening_time)) < 30;
SELECT AVG(T3.user_id) FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Reviews AS T3 ON T1.business_id = T3.business_id WHERE T1.active = 'true' GROUP BY T2.closing_time - T2.opening_time HAVING SUM(T2.closing_time - T2.opening_time) < 30
4,052
public_review_platform
How many business ids have opening hours from 8AM to 6PM?
opening hours from 8AM to 6PM refer to Business_Hours where opening_time = '8AM' and closing_time = '6PM';
SELECT DISTINCT business_id FROM Business_Hours WHERE opening_time = '8AM' AND closing_time = '6PM'
4,053
public_review_platform
Provide business ids with opening hours 10AM on Saturday.
opening hours 10AM on Saturday refer to Business_Hours where opening_time = '10AM' and day_id = 6;
SELECT DISTINCT business_id FROM Business_Hours WHERE day_id = 6 AND opening_time = '10AM'
4,054
public_review_platform
Indicate the business id and days which are opened from 8AM to 6PM.
opened from 8AM to 6PM refers to Business_Hours where opening_time = '8AM' and closing_time = '6PM'; days refer to day_id;
SELECT DISTINCT day_id FROM Business_Hours WHERE opening_time = '8AM' AND closing_time = '6PM'
4,055
public_review_platform
How many businesses id are rated more than 4?
rated more than 4 refers to stars > 4;
SELECT COUNT(business_id) FROM Business WHERE stars > 4
4,056
public_review_platform
What are the categories of businesses that have opening time on Sunday?
categories of businesses refer to category_name; Sunday refers to day_of_week where day_id = 1;
SELECT DISTINCT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T2.business_id = T3.business_id INNER JOIN Days AS T4 ON T3.day_id = T4.day_id WHERE T4.day_of_week = 'Sunday' AND T3.opening_time <> ''
4,057
public_review_platform
Please indicate the opening day of businesses whose category is pets.
category is pets refers to category_name = 'Pets'; opening day refers to day_id from Business_Hours and opening_time;
SELECT DISTINCT T4.day_of_week FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T1.business_id = T3.business_id INNER JOIN Days AS T4 ON T3.day_id = T4.day_id WHERE T2.category_name = 'Pets'
4,058
public_review_platform
Please indicate the closing hours and business days of the businesses with the category named Doctors.
closing hours refer to closing_time; business days refer to day_id from Business_Hours;
SELECT DISTINCT T3.opening_time, T3.day_id FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T1.business_id = T3.business_id INNER JOIN Days AS T4 ON T3.day_id = T4.day_id WHERE T2.category_name = 'Doctors'
4,059
public_review_platform
Among the working days from Monday to Saturday, which businesses with the category names work the most days?
days from Monday to Saturday refer to day_id between 2 and 7; work the most days can be computed as MAX(COUNT(category_name where day_id between 2 and 7));
SELECT T2.category_name FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T1.business_id = T3.business_id INNER JOIN Days AS T4 ON T3.day_id = T4.day_id GROUP BY T2.category_name ORDER BY COUNT(T3.day_id) DESC LIMIT 1
4,060
public_review_platform
Please indicate the business id have the closing time with the category of Arts & Entertainment on Sunday.
Sunday refers to day_of_week = 'Sunday' where day_id = 1; category of Arts & Entertainment refers to category_name = 'Arts & Entertainment';
SELECT T1.business_id, T3.closing_time FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T1.business_id = T3.business_id INNER JOIN Days AS T4 ON T3.day_id = T4.day_id WHERE T2.category_name = 'Arts & Entertainment' AND T4.day_of_week = 'Sunday'
4,061
public_review_platform
In businesses with a category of "DJs", how many businesses are rated less than 5?
category of "DJs" refers to category_name = 'DJs'; rated less than 5 refers to stars < 5; businesses refer to business_id;
SELECT COUNT(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 = 'DJs' AND T1.stars < 5
4,062
public_review_platform
List active business ids with opening times of 7AM and closing times of 8PM.
opening times of 7AM and closing times of 8PM refer to Business_Hours where opening_time = '7AM' and closing_time = '8PM'; active business refers to business_id where active = 'true';
SELECT DISTINCT T4.business_id FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business_Hours AS T3 ON T2.business_id = T3.business_id INNER JOIN Business AS T4 ON T3.business_id = T4.business_id WHERE T4.active = 'true' AND T3.opening_time = '7AM' AND T3.closing_time = '8PM'
4,063
public_review_platform
How many businesses with the category named Stadiums & Arenas are rated highest?
rated highest refers to MAX(stars); category_name = 'Stadiums & Arenas';
SELECT COUNT(T1.business_id) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T2.category_name = 'Stadiums & Arenas' AND T3.stars = ( SELECT MAX(stars) FROM Business )
4,064
public_review_platform
How many category id have low review count and rating more than 2?
rating more than 2 refers to stars > 2;
SELECT COUNT(DISTINCT T1.category_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.review_count = 'Low' AND T3.stars > 2
4,065
public_review_platform
Which businesses with the category name Accessories have opening hours before 7AM?
opening hours before 7AM refer to opening_time < '7AM'; businesses refer to business_id;
SELECT T1.business_id FROM Business_Hours 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 = 'Accessories' AND SUBSTR(T1.opening_time, -4, 2) * 1 < 7 AND T1.opening_time LIKE '%AM'
4,066
public_review_platform
Among the active businesses in Arizona, how many businesses work after 12PM?
active businesses in Arizona refer to business_id where state = 'Arizona' and active = 'true'; work after 12PM refer to opening_time > '12PM';
SELECT COUNT(DISTINCT T2.business_id) FROM Business_Hours 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.active = 'true' AND T2.state = 'AZ' AND T1.opening_time > '12PM'
4,067
public_review_platform
Please provide the name of businesses with user id "16328".
name of business refers to category_name;
SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Tips AS T3 ON T2.business_id = T3.business_id WHERE T3.user_id = 16328
4,068
public_review_platform
How many businesses have the category named food? List those businesses and find the percentage of businesses with less than 2 stars.
businesses have the category named food refer to business_id where category_name = 'Food'; DIVIDE(COUNT(business_id where category_name = 'Food' and stars < 2), COUNT(business_id where category_name = 'Food')) as percentage;
SELECT T3.business_id, CAST((( SELECT COUNT(business_id) FROM Business WHERE stars < 2 ) - ( SELECT COUNT(business_id) FROM Business WHERE stars > 2 )) AS REAL) * 100 / ( SELECT COUNT(stars) FROM Business ) FROM Business_Categories AS T1 INNER JOIN Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T1.business_id = T3.business_id WHERE T2.category_name = 'Food'
4,069
public_review_platform
Calculate the percentage of businesses with the category name food that are open from 7AM to 8PM in the businesses with the same time.
DIVIDE(COUNT(business_id where category_name = 'Food' and opening_time = '7AM' and closing_time = '8PM'), COUNT(business_id where opening_time = '7AM' and closing_time = '8PM')) as percentage;
SELECT CAST(SUM(CASE WHEN T3.category_name = 'Food' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.category_name) FROM Business_Categories AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T1.category_id = T3.category_id
4,070
public_review_platform
Write down the number of running business with each review count in Cave Creek city.
number of running business refers to COUNT(business_id) where active = 'true'; each review count includes review_count = 'High', review_count = 'Medium', review_count = 'Low';
SELECT SUM(CASE WHEN review_count = 'High' THEN 1 ELSE 0 END) AS high , SUM(CASE WHEN review_count = 'Medium' THEN 1 ELSE 0 END) AS Medium , SUM(CASE WHEN review_count = 'Low' THEN 1 ELSE 0 END) AS low FROM Business WHERE city = 'Cave Creek' AND active = 'true'
4,071
public_review_platform
Calculate the yearly average user who started using Yelp from the year of 2005 to 2014.
avg(user_id) where user_yelping_since_year BETWEEN '2005' AND '2014';
SELECT AVG(user_id) FROM Users WHERE user_yelping_since_year >= 2005 AND user_yelping_since_year <= 2015
4,072
public_review_platform
What is the active and inactive ratio of the business with the review count of low.
DIVIDE(COUNT(business_id where review_count = 'Low' and active = 'true'), COUNT(business_id where review_count = 'Low' and active = 'false'));
SELECT CAST(SUM(CASE WHEN active = 'true' THEN 1 ELSE 0 END) AS REAL) / SUM(CASE WHEN active = 'false' THEN 1 ELSE 0 END) AS radio FROM Business WHERE review_count = 'Low'
4,073
public_review_platform
List any five of user ID who became elite user in 2006.
year_id = '2006';
SELECT user_id FROM Elite WHERE year_id = 2006 LIMIT 5
4,074
public_review_platform
Write down the any five of ID and name of category that starts with alphabet "P".
category that starts with alphabet "P" refers to category_name like 'P%';
SELECT category_id, category_name FROM Categories WHERE category_name LIKE 'P%' LIMIT 5
4,075
public_review_platform
Provide the list of user ID along with review star of which has the review length of medium with business ID of 35.
;
SELECT user_id, review_stars FROM Reviews WHERE business_id = 15 AND review_length = 'Medium'
4,076
public_review_platform
List down the business ID and attribute value of the attribute name of "payment_types_visa".
SELECT T2.business_id, T2.attribute_value FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name = 'payment_types_visa'
4,077
public_review_platform
Describe ID and active status of the business under category of "Diagnostic Imaging".
ID refers to business_id; category of "Diagnostic Imaging" refers to category_name = 'Diagnostic Imaging';
SELECT T2.business_id, T3.active 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 = 'Diagnostic Imaging'
4,078
public_review_platform
Mention the user ID and their year of joining Yelp who had great experience on business ID 143.
year of joining Yelp refers to user_yelping_since_year; great experience refers to Reviews where review_stars = 5;
SELECT T2.user_id, T2.user_yelping_since_year FROM Reviews AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.business_id = 143 AND T1.review_stars = 5
4,079
public_review_platform
Among the user ID with number in compliment of uber on profile, list any 5 user ID and the year when they join Yelp.
when join Yelp refers to user_yelping_since_year; compliment_type = 'profile'; number_of_compliments = 'Uber';
SELECT T3.user_id, T3.user_yelping_since_year 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 T1.compliment_type = 'profile' AND T2.number_of_compliments = 'Uber' LIMIT 5
4,080
public_review_platform
List the user ID, business ID with review length of the business which received the most likes in tips.
business which received the most likes refers to business_id where MAX(likes);
SELECT T1.user_id, T1.business_id, T2.review_length FROM Tips AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id ORDER BY T1.likes DESC LIMIT 1
4,081
public_review_platform
Among the elite users of 10 consecutive year from 2005 to 2014, list down the user ID and their number of compliment on photos.
from 2005 to 2014 refers to year_id BETWEEN 2005 AND 2014; compliment_type = 'photos';
SELECT T2.user_id, T2.number_of_compliments FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id INNER JOIN Elite AS T3 ON T2.user_id = T3.user_id WHERE T3.year_id BETWEEN 2005 AND 2014 AND T1.compliment_type = 'photos'
4,082
public_review_platform
Calculate the percentage of business which opened on Sunday from 9AM to 9PM based on the number of business opened on Sunday.
Sunday refers to day_of_week = 'Sunday' where day_id = 1; opened from 9AM to 9PM refers to Business_Hours where opening_time = '9AM' and closing_time = '9PM'; DIVIDE(COUNT(opening_time = '9AM' and closing_time = '9PM' and day_of_week = 'Sunday'), COUNT(opening_time = NOT NULL and closing_time = NOT NULL and day_of_week = 'Sunday')) as percentage;
SELECT CAST(SUM(CASE WHEN T2.opening_time = '9AM' AND T2.closing_time = '9PM' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.day_id) FROM Days AS T1 INNER JOIN Business_Hours AS T2 ON T1.day_id = T2.day_id WHERE T1.day_of_week = 'Sunday'
4,083
public_review_platform
Write down the ID and opening day of a week for the business which are running in Black Canyon City.
running refers to active = 'true'; opening day of a week means days of the week when business is open;
SELECT T2.business_id, 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 = 'Black Canyon City' AND T1.active = 'true'
4,084
public_review_platform
Within the user who joined Yelp in 2004, explore the user ID with average star of 5 and it's review length on the business.
user who joined Yelp in 2004 refers to user_id where user_yelping_since_year = 2014; user_average_stars = 5;
SELECT T2.user_id, T2.review_length FROM Users AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2004 AND T1.user_average_stars = 5
4,085
public_review_platform
Which business ID received the review of 4 star and above by 65% of user? Describe their active status and city.
review of 4 star and above refers to stars > 4; DIVIDE(SUM(stars > 4), COUNT(business_id)) = 0.65;
SELECT DISTINCT T2.business_id, T2.city FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.review_stars >= 4 AND ( SELECT CAST(( SELECT COUNT(DISTINCT T1.user_id) FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.review_stars >= 4 ) AS REAL) * 100 / ( SELECT COUNT(user_id) FROM Users ) > 65 )
4,086
public_review_platform
Calculate the difference between running business in Glendale City and Mesa City.
running business refers to business where active = 'true';
SELECT SUM(CASE WHEN city = 'Glendale' THEN 1 ELSE 0 END) - SUM(CASE WHEN city = 'Mesa' THEN 1 ELSE 0 END) AS diff FROM Business WHERE active = 'true'
4,087
public_review_platform
How many likes did short comment left by users who joined in 2010 get?
short comment refers to tip_length = 'Short'; users who joined in 2010 refer to user_id where user_yelping_since_year = 2010;
SELECT SUM(T2.likes) FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2010
4,088
public_review_platform
For users with average ratings of 3, what kind of tip length they mostly left?
average ratings of 3 refer to user_average_stars = 3; kind of tip length they mostly left refers to tip_length where MAX(COUNT(user_id));
SELECT T2.tip_length FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_average_stars = 3 GROUP BY T2.tip_length ORDER BY COUNT(T2.tip_length) DESC LIMIT 1
4,089
public_review_platform
Sum up the likes get by short reviews on businesses located in City Goodyear.
short reviews refer to tip_length = 'Short';
SELECT SUM(T2.likes) AS likes FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Goodyear'
4,090
public_review_platform
For businesses with long length reviews, which state are they located?
businesses with long length tips refer to business_id where tip_length = 'Long';
SELECT DISTINCT T1.state FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T2.tip_length = 'Long'
4,091
public_review_platform
How much time do businesses in El Mirage City, AZ State operate in average daily?
how much time does this business open refers to SUBTRACT(closing_time, opening_time); DIVIDE(SUM(SUBTRACT(closing_time, opening_time)), SUM(Business.business_id))
SELECT SUM(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 = 'El Mirage' AND T1.state = 'AZ'
4,092
public_review_platform
List down the closing day of businesses located at SC State.
closing day refers to SUBTRACT(days.day_id, business_Hours.day_id)
SELECT T3.day_id - T2.day_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.state = 'SC'
4,093
public_review_platform
List down the category of businesses whose stars ratings are 5.
category of businesses refers to category_name; stars ratings are 5 refers to stars = 5
SELECT DISTINCT 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.stars = 5
4,094
public_review_platform
What are the states of businesses with attribute of beer and wine located?
with attribute of beer and wine refers to attribute_value = 'beer_and_wine';
SELECT DISTINCT T2.state FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.attribute_value = 'beer_and_wine'
4,095
public_review_platform
How many user's compliment in photo has medium in number?
user's compliment in photo refers to compliment_type = 'photo'; photo has medium in number refers to number_of_compliments = 'Medium'
SELECT COUNT(T2.user_id) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'photos' AND T2.number_of_compliments = 'Medium'
4,096
public_review_platform
Among businesses with "Wi-Fi" attribute, which businesses id are located at SC State?
"Wi-Fi" attribute refers to attribute_name = 'Wi-Fi' AND attribute_value = 'true'
SELECT T3.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 = 'Wi-Fi' AND T2.attribute_value = 'true' AND T3.state = 'SC'
4,097
public_review_platform
Sum up the number of business with "ambience_romantic" attribute.
"ambience_romantic" attribute 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 T1.attribute_name = 'ambience_romantic' AND T2.attribute_value = 'true'
4,098
public_review_platform
What is the percentage of businesses with "Good for Kids" attribute over the other attributes?
"Good for Kids" attribute refers to attribute_name = 'Good for Kids' AND attribute_value = 'true'; Calculation = DIVIDE(SUM(attribute_name = 'Good for Kids' AND attribute_value = 'true')), SUM(business_id) * 100
SELECT CAST(SUM(CASE WHEN attribute_name = 'Good for Kids' THEN 1 ELSE 0 END) AS REAL) * 100 / 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'
4,099