problem
stringlengths 121
422
| db_id
stringclasses 69
values | solution
stringlengths 23
804
|
---|---|---|
Write SQL query to solve given problem: How many more "Chinese" than "Filipino" Yelp businesses?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT SUM(CASE WHEN T1.category_name LIKE 'Chinese' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.category_name LIKE 'Filipino' THEN 1 ELSE 0 END) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id |
Write SQL query to solve given problem: User No."63469" has got "1" like for a tip to the Yelp business, which city is that business located in?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.city FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T2.likes = 1 AND T2.user_id = 63469 |
Write SQL query to solve given problem: How many types of music does Yelp business No."1141" have?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(T1.attribute_name) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_value LIKE 'TRUE' AND T2.business_id = 1141 |
Write SQL query to solve given problem: How many "cute" type of compliments does user No. 57400 get?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(T1.compliment_type) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type LIKE 'cute' AND T2.user_id = 57400 |
Write SQL query to solve given problem: Who has got the most number of "funny" type of compliments? Give the user ID.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT user_id FROM Users_Compliments WHERE compliment_id IN ( SELECT compliment_id FROM Compliments WHERE compliment_type LIKE 'funny' ) |
Write SQL query to solve given problem: Give the number of "drive-thru" businesses in "Scottsdale" with business ID number less than "1000".. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 T3.business_id < 1000 AND T3.city LIKE 'Scottsdale' AND T1.attribute_name LIKE 'Drive-Thru' AND T2.attribute_value LIKE 'TRUE' |
Write SQL query to solve given problem: What is the average rating for the all Yelp businesses that open 24 hours?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT CAST(SUM(T3.stars) AS REAL) / COUNT(T2.business_id) AS "avg" 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 'Open 24 Hours' AND T2.attribute_value LIKE 'TRUE' |
Write SQL query to solve given problem: For all the Yelp businesses that allow customers bring their own beer, what percentage of them are in "Phoenix"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT CAST(SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.business_id) AS "percentage" 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 'BYOB' AND T2.attribute_value LIKE 'TRUE' |
Write SQL query to solve given problem: List the names of business in AZ with a rating of 5.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT business_id FROM Business WHERE state LIKE 'AZ' AND stars = 5 |
Write SQL query to solve given problem: How many active businesses of city are underrated?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE review_count LIKE 'Low' AND active LIKE 'TRUE' |
Write SQL query to solve given problem: How many user ids from 1 to 20 have no fan users and have low ratings?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(user_id) FROM Users WHERE user_id BETWEEN 1 AND 20 AND user_fans LIKE 'None' AND user_review_count LIKE 'Low' |
Write SQL query to solve given problem: Indicate the opening hours of businesses are with category in fashion.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T4.opening_time 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 LIKE 'Fashion' |
Write SQL query to solve given problem: How many businesses operating in the shopping business have opening times before 8AM?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T4.opening_time < '8AM' AND T1.category_name LIKE 'Shopping' |
Write SQL query to solve given problem: Provide name of businesses whose category is pets and are still opened after 9PM.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T4.closing_time > '9PM' AND T1.category_name LIKE 'Pets' |
Write SQL query to solve given problem: How many businesses with the category are open from Monday to Thursday?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id INNER JOIN Days AS T5 ON T4.day_id = T5.day_id WHERE T5.day_of_week LIKE 'Monday' OR T5.day_of_week LIKE 'Tuesday' OR T5.day_of_week LIKE 'Wednesday' OR T5.day_of_week LIKE 'Thursday' |
Write SQL query to solve given problem: Please indicate the review count of the "active life" businesses in Phoenix.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(*) 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 = 'Active Life' AND T3.city = 'Phoenix' |
Write SQL query to solve given problem: Please list the businesses name with a rating less than 5 whose category name is men's clothing.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 'Men''s Clothing' AND T3.stars < 5 |
Write SQL query to solve given problem: Which businesses are no longer in business but have a low number of votes useful?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT DISTINCT T1.business_id 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.active LIKE 'FALSE' AND T1.review_votes_useful LIKE 'Low' |
Write SQL query to solve given problem: Please list the businesses names whose length of user review is long with business id from 1 to 20.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 'Long' AND T3.category_id BETWEEN 1 AND 20 GROUP BY T4.category_name |
Write SQL query to solve given problem: Please provide the attribute values of the bussinesses with fashion in Scottsdale.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T2.attribute_value FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id INNER JOIN Business_Categories AS T3 ON T1.business_id = T3.business_id INNER JOIN Categories AS T4 ON T3.category_id = T4.category_id WHERE T4.category_name LIKE 'Fashion' AND T1.city LIKE 'Scottsdale' |
Write SQL query to solve given problem: How many compliments received from medium users that Phoenix city achieved?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(T1.number_of_compliments) FROM Users_Compliments AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.city LIKE 'Phoenix' AND T1.number_of_compliments LIKE 'Medium' |
Write SQL query to solve given problem: Provide the businesses name in Tempe city whose opening hours are earlier than 8AM.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T3.city LIKE 'Tempe' AND T4.opening_time < '8AM' |
Write SQL query to solve given problem: How many businesses in Glendale city that are still running is opened from 8AM to 6PM?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(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 INNER JOIN Business_Hours AS T4 ON T3.business_id = T4.business_id WHERE T3.city LIKE 'Glendale' AND T4.opening_time LIKE '8AM' AND T4.closing_time LIKE '6PM' |
Write SQL query to solve given problem: How many businesses are there in Phoenix city? Find the percentage of businesses in Phoenix city in the total city.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS "num" , CAST(SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.city) 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 |
Write SQL query to solve given problem: How many cities have businesses with active life category? Find the percentage of the city where the review count that is low in total review count.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT SUM(CASE WHEN T2.category_name LIKE 'Active Life' THEN 1 ELSE 0 END) AS "num" , CAST(SUM(CASE WHEN T3.city LIKE 'Phoenix' THEN 1 ELSE 0 END) AS REAL) * 100 / ( SELECT COUNT(T3.review_count) 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 T3.review_count LIKE 'Low' ) 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 |
Write SQL query to solve given problem: How many active businesses are there in Phoenix?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Phoenix' AND active LIKE 'TRUE' |
Write SQL query to solve given problem: How many businesses in Scottsdale are rated as "wonderful experience"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Scottsdale' AND stars > 3 |
Write SQL query to solve given problem: What is the average rating of inactive businesses?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT CAST(SUM(stars) AS REAL) / COUNT(business_id) AS "average" FROM Business WHERE active LIKE 'FALSE' |
Write SQL query to solve given problem: How many businesses in AZ state have the beer_and_wine attribute?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T2.attribute_value LIKE 'beer_and_wine' AND T1.state LIKE 'AZ' |
Write SQL query to solve given problem: Which city has the most businesses whose attribute is full_bar?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.city FROM Business AS T1 INNER JOIN Business_Attributes AS T2 ON T1.business_id = T2.business_id WHERE T2.attribute_value LIKE 'full_bar' GROUP BY T1.city |
Write SQL query to solve given problem: How many businesses in the fashion industry are rated 5 stars?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 = 5 AND T3.category_name LIKE 'Fashion' |
Write SQL query to solve given problem: Which city has the highest number of businesses in the food industry whose number of reviews is high?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.city 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.review_count LIKE 'High' AND T3.category_name LIKE 'Food' GROUP BY T1.city |
Write SQL query to solve given problem: Please list all business IDs in Mesa city that review stars of over 3.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.business_id FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T1.city LIKE 'Mesa' AND T2.review_stars > 3 GROUP BY T1.business_id |
Write SQL query to solve given problem: Which city has the least number of businesses whose amount of funny votes is low?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.city FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T2.review_votes_funny LIKE 'low' GROUP BY T1.city |
Write SQL query to solve given problem: What percentage of businesses are in the Real Estate sector and have the rating of 5 out of all businesses in Chandler?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT CAST(SUM(CASE WHEN T1.stars = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.business_id) 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 T1.city LIKE 'Chandler' AND T3.category_name LIKE 'Real Estate' |
Write SQL query to solve given problem: How many users who started yelping since 2012 have sent a high number of funny votes?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year = 2012 AND user_votes_funny LIKE 'High' |
Write SQL query to solve given problem: What is the number of useful votes that the user 52592 received when reviewed for business number 2?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT review_votes_useful FROM Reviews WHERE user_id = 52592 AND business_id = 2 |
Write SQL query to solve given problem: What are the attribute numbers that are related to payment?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT attribute_id FROM Attributes WHERE attribute_name LIKE '%payment%' |
Write SQL query to solve given problem: How long was the review for business number 2 that user number 612 wrote?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT review_length FROM Reviews WHERE user_id = 612 AND review_stars = 5 AND business_id = 2 |
Write SQL query to solve given problem: How many businesses are actively running in Gilbert City?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Gilbert' AND active LIKE 'True' |
Write SQL query to solve given problem: How many businesses in the AZ state got low quality of reviews?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND review_count LIKE 'Low' |
Write SQL query to solve given problem: Please state any three business numbers in AZ state that have received the "Great experience" review stars.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT DISTINCT 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.review_stars = 5 LIMIT 3 |
Write SQL query to solve given problem: Please name one attribute that business number 2 does not have.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.attribute_name FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_value LIKE 'none' LIMIT 1 |
Write SQL query to solve given problem: How many "cool" compliments did user number 33 receive?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(T2.compliment_type) FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.user_id = 33 AND T2.compliment_type LIKE 'cool' |
Write SQL query to solve given problem: What are the opening hours of business number 53 on Friday?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.closing_time - T1.opening_time AS "opening hours" FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week LIKE 'Friday' AND T1.business_id = 53 |
Write SQL query to solve given problem: What are the attributes that business number 56 have?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.attribute_name FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_value LIKE 'TRUE' AND T2.business_id = 56 |
Write SQL query to solve given problem: What are the categories that business number 15 belongs to?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: How many businesses are there in Scottsdale city under the category of "Beauty & Spas"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: Please list any two user numbers that have an "Uber" number of cute compliments.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: How many businesses operating in the "Accessories" category have received a "wonderful experience" review from users?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How long does business number 12 in Scottsdale stay open on day number 3?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T2.closing_time - T2.opening_time AS "hour" FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.business_id = 12 AND T1.city LIKE 'Scottsdale' AND T2.day_id = 3 |
Write SQL query to solve given problem: How many businesses in AZ state do not open on Thursday?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How many businesses of Yelp are in Scottsdale?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Scottsdale' |
Write SQL query to solve given problem: Among the Yelp_Businesses in Arizona, how many of them are still running?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND active LIKE 'True' |
Write SQL query to solve given problem: How many Yelp_Businesses in Scottsdale have received positive comments in the Elitestar rating?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE city LIKE 'Scottsdale' AND stars > 3 |
Write SQL query to solve given problem: Which city has more Yelp_Business that's more appealing to users, Scottsdale or Anthem?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT city FROM Business ORDER BY review_count DESC LIMIT 1 |
Write SQL query to solve given problem: How many Yelp_Businesses in Arizona have a Elitestar rating of over 4?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND stars > 4 |
Write SQL query to solve given problem: How many Yelp_Businesses are there in Arizona in total?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' |
Write SQL query to solve given problem: Please list the cities of the Yelp_Businesses that have gotten a 5 in the Elitestar rating.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT city FROM Business WHERE stars = 5 GROUP BY city |
Write SQL query to solve given problem: How many reviews have the user whose ID is 3 posted?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(review_length) FROM Reviews WHERE user_id = 3 |
Write SQL query to solve given problem: How many reviews made by user whose ID is 3 are long?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(review_length) FROM Reviews WHERE user_id = 3 AND review_length LIKE 'Long' |
Write SQL query to solve given problem: Among the long reviews made by user ID 3, how many of them have received a medium number of useful votes?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(review_length) FROM Reviews WHERE user_id = 3 AND review_length LIKE 'Long' AND review_votes_useful LIKE 'Medium' |
Write SQL query to solve given problem: How many users have joined Yelp since the year 2012?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year = 2012 |
Write SQL query to solve given problem: Please list the IDs of the users who have a high number of followers.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT user_id FROM Users WHERE user_fans LIKE 'High' GROUP BY user_id |
Write SQL query to solve given problem: How many Yelp_Businesses do not provide alcohol?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: Among the Yelp_Businesses in Arizona, how many of them do not provide alcohol?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: Please list the business IDs of all the Yelp_Businesses that are good for kids.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T2.business_id FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name LIKE 'Good for Kids' AND T2.attribute_value LIKE 'TRUE' |
Write SQL query to solve given problem: How many Yelp_Business falls under the category of "Shopping"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: Under which categories is Yelp_Business no. 1?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: Among the Yelp_Businesses which are still running, how many of them fall under the category of "Food"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How many Yelp_Business in Anthem are under the category of "Food"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: Please list the business ID of the Yelp_Business with the highest Elitestar rating under the category "Food".. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: How many Yelp_Business under the category of "Food" are good for kids?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How many Yelp_Business in Arizona has user no. 3 reviewed?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: Please list all the categories of the Yelp_Business in Arizona.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: How long does Yelp_Business no.1 open on Tuesdays?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.closing_time - T1.opening_time AS "opening hours" FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week LIKE 'Tuesday' AND T1.business_id = 1 |
Write SQL query to solve given problem: When does Yelp_Business no.1 open on Tuesdays?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.opening_time FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T2.day_of_week LIKE 'Tuesday' AND T1.business_id = 1 |
Write SQL query to solve given problem: How many Yelp_Business close after 8PM on Mondays?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: Please list the opening time on Mondays of all the Yelp_Businesses in Anthem that are still running.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.opening_time 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 'Monday' AND T3.city LIKE 'Anthem' AND T3.active LIKE 'True' GROUP BY T1.opening_time |
Write SQL query to solve given problem: Among the Yelp_Business in Arizona, how many of them closes at 12PM on Sundays?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: Please list the categories of the Yelp_Business that closes at 12PM on Sundays.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: How many "Good for Kids" Yelp_Businesses are open everyday of the week?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How many users became an elite user the same year they joined Yelp?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: What is the longest business time on Mondays for a Yelp_Business under the category "Shopping"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.closing_time + 12 - T1.opening_time AS "hour" 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_Categories AS T4 ON T3.business_id = T4.business_id INNER JOIN Categories AS T5 ON T4.category_id = T5.category_id WHERE T2.day_of_week LIKE 'Monday' AND T5.category_name LIKE 'Shopping' ORDER BY T1.closing_time + 12 - T1.opening_time DESC LIMIT 1 |
Write SQL query to solve given problem: Please list the business IDs of the Yelp_Business that have a business time of longer than 12 hours on Sundays.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT 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 T1.closing_time + 12 - T1.opening_time > 12 AND T2.day_of_week LIKE 'Sunday' GROUP BY T1.business_id |
Write SQL query to solve given problem: How many elite users have reviewed Yelp_Business no.1?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: Among the users who have posted more than 10 reviews, how many users are elite users?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(T4.user_id) FROM ( SELECT 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.user_id IS NOT NULL GROUP BY T3.user_id HAVING COUNT(T3.user_id) > 10 ) T4 |
Write SQL query to solve given problem: Which Yelp_Business in Arizona gets the most number of reviews?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: How many stars on average does a Yelp_Business in Anthem get from a user review?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How many stars on average does user no.3 give to Yelp_Business in Arizona?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: What is the average business time for Yelp_Business no.1 on weekends?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.closing_time + 12 - T1.opening_time AS "avg opening hours" FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T1.business_id = 1 AND (T2.day_of_week = 'Sunday' OR T2.day_of_week = 'Sunday') |
Write SQL query to solve given problem: What is the average Elitestar rating for a Yelp_Business that closes at 12PM on Sundays?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How many of the busineses are in Casa Grande?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(city) FROM Business WHERE city LIKE 'Casa Grande' |
Write SQL query to solve given problem: What is the total number of active businesses in AZ with a low review count?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND active LIKE 'True' AND review_count LIKE 'low' |
Write SQL query to solve given problem: List down the business ID with a star range from 2 to 3, located at Mesa.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT business_id FROM Business WHERE city LIKE 'Mesa' AND stars BETWEEN 2 AND 3 |
Write SQL query to solve given problem: In users yelping since 2011 to 2013, how many of them have high count of fans?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year BETWEEN 2011 AND 2013 AND user_fans LIKE 'High' |
Write SQL query to solve given problem: What is the review length of user 35026 to business with business ID 2?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT review_length FROM Reviews WHERE user_id = 35026 AND business_id = 2 |
Write SQL query to solve given problem: Among the businesses in Chandler, list the attribute of the business with a low review count.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: In businesses with a category of mexican, how many of them has a star rating below 4?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: List the active business ID and its stars of the businesses fall under the category of Fashion.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 'Fashion' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.