db_id
stringclasses
69 values
schema
stringclasses
69 values
m_schema
stringclasses
69 values
question
stringlengths
24
325
sql
stringlengths
23
804
evidence
stringlengths
0
673
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many businesses ID sell beer and wine?
SELECT COUNT(business_id) FROM Business_Attributes WHERE attribute_id = 1 AND attribute_value = 'beer_and_wine'
attribute_value = 'beer_and_wine'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many attributes ID owned by business ID 2?
SELECT COUNT(attribute_id) FROM Business_Attributes WHERE business_id = 2
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many users received high compliment type in photo?
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
high compliments refers to number_of_compliments = 'High'; type in photo refers to compliment_ID = 1
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many businesses in Phoenix, Arizona is attributed to waiter service?
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
'Phoenix' is the city; waiter service refers to attribute_name = 'waiter_services'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Find out which business is opened for 24/7 and list out what is the business attribute.
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'...
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
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Which business in fashion category has the most review?
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_i...
'Fashion' is the category_name; most review refers to Max(Count(user_id))
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List out which business category that are most likely to have average good review in Arizona?
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
average good review refers to review_count > = 3; Arizona refers to state = 'AZ'; business category refers to category_name
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the ratio of having the best to worse elite user in 2013?
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
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)))
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Calculate the increment percentage of elite user for each year since year 2005.
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
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
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many business have been reviewed by user ID 3 and how long have this user been with Yelp?
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
year with yelp = Subtract ('%Y'(CURRENT TIME), user_yelping_since_year)
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the yearly average review done by user ID 3?
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
yearly average review = Divide( Count(business_id), Subtract('%Y'(CURRENT_TIME), user_yelping_since_year))
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the average number of review received by each business given that the user is an elite?
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
average review = Divide(Count(user_id), Count(business_id))
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
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?
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
elite user for consecutively 5 years or more refers to user_id COUNT(year_id) > 5; Average star = AVG(likes)
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Find out which hotel and travel business having the most review? Calculate the standard deviation of the review star for this business.
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
"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))
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the correlation between the review starts and business stars?
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
highest review count refers to review_count = 'Uber'; average business review stars = Divide (Sum(review_stars), Count(user_id))
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many of the businesses are active?
SELECT COUNT(business_id) FROM Business WHERE active LIKE 'True'
active refers to active = 'true'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List down the business ID with a low review count in Phoenix.
SELECT business_id FROM Business WHERE city LIKE 'Phoenix' AND review_count LIKE 'Low'
"Phoenix" is the city; low review count refers to review_count = 'Low'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the total number of active business in AZ with a high review count?
SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND review_count LIKE 'High' AND active LIKE 'True'
active business refers to active = 'true'; 'AZ' is the state; high review count refers to review_count = 'High'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List down the business ID with a star range from 3 to 4, located at Tempe.
SELECT business_id FROM Business WHERE city LIKE 'Tempe' AND stars BETWEEN 3 AND 4
star range from 3 to 4 refers to stars > = 3 AND stars < 5; 'Tempe' is the name of city
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
In users yelping since 2010 to 2012, how many of them has an low fans?
SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year BETWEEN 2010 AND 2012 AND user_fans LIKE 'Low'
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'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the review length of user 60776 to business with business ID 1?
SELECT review_length FROM Reviews WHERE user_id = 60776 AND business_id = 1
"60776" is the user_id
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Among the businesses in Scottsdale, list the attribute of the business with a high review count.
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
"Scottsdale" is the name of city; high review count refers to review_count = 'High'; attribute of the business refers to attribute_name
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
In businesses with a category of automotive, how many of them has an star rating below 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
"Automotive" is the category of business; star rating below 3 refers to stars < 3
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List the active business ID and its stars of the businesses fall under the category of Pets.
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'
active business refers to active = 'true'; 'Pets' is the category_name
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the attribute of the business with highest star rating?
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
highest star rating Max(stars); attribute of business refers to attribute_name
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the category of the business with short review length and highest review stars within business ID from 5 t0 10?
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 ...
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
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Count the active businesses that has an attribute of Wi-Fi with medium review count.
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'
active business refers to active = 'true'; 'Wi-Fi' is the attribute_name; medium review count refers to review_count = 'Medium'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the closing and opening time of businesses located at Gilbert with highest star rating?
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
"Gilbert" is the name of city; highest star rating refers to Max(stars)
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Among the active businesses located at Mesa, AZ, list the category and attributes of business with a low review count.
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'
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
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List the categories of inactive businesses in AZ.
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'
inactive business refers to active = 'FALSE'; 'AZ' is the state; category refers to category_name
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Find the location of businesses that has business hours from 9 am to 9 pm every 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 '9PM' AND T2.opening_time LIKE '9AM' AND T3.day_of_week LIKE 'Saturday' GROUP BY T1.city
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
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the attribute value of an inactive business with a medium review count and 3.5 stars which is located at Phoenix, AZ?
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
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
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the opening time of the active businesses in Surprise that has a low review count.
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
active business refers to active = 'true'; 'Surprise' is the name of city;  low review count refers to review_count = 'Low'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Among the businesses with a category of Local Services, what is the percentage of the business with less than 3 stars?
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 'L...
"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
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
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.
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...
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%
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many users have no followers in 2014?
SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year = 2004 AND user_fans LIKE 'None'
in 2004 refers to user_yelping_since_year = 2004; no follower refers to user_fans = 'None'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List at least 5 users that has received less than 5 low compliments from other users.
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
less than 5 low compliment refers to number_of_compliments < 5
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List at least 10 users ID that has 4 as an average ratings of all reviews sent.
SELECT COUNT(user_id) FROM Users WHERE user_average_stars = 4 LIMIT 10
4 as an average rating refers to user_average_stars = 4
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What city does the business have a business hour from 10 am to 12 pm on 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'
10 am refers to opening_time = '10AM'; 12 pm refers to closing_time = '12PM'; on Sunday refers to day_of_week = 'Sunday'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many businesses are opened for 24 hours?
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'
opened for 24 hours refers to attribute_name = 'Open 24 Hours' AND attribute_value = 'true'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List at least 5 active business ID that are good for groups and dancing.
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
"Good for Groups" and "Good for Dancing" are attribute_name; active business refers to active = true'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Among the active businesses in Ahwatukee, which of them are still open in 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'
active business refers to active = 'true'; 'Ahwatukee' is the name of city; open in Sunday refers to day_of_week = 'Sunday'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List the categories of all active businesses that were not in Arizona.
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'
active business refers to active = 'true'; not in Arizona refers to state ! = 'AZ'; category refers to category_name
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List the category of the business with high review count but received 2 stars.
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'
high review count refers to review_count = 'High'; received 2 stars refers to stars = 2; category refers to category_name
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many businesses have a romantic ambiance?
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'
romantic ambiance refers to attribute_name = 'ambience_romantic' AND attribute_value = 'true'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List the city of the business where they open from 1 pm to 6 pm on 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'
1 pm refers to opening_time = '1PM'; 6 pm refers to closing_time = '6PM'; on Saturday refers to day_of_week = 'Saturday'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the total number of fans or followers who received most likes of their comments in the business?
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
fans and followers refers to user_fans; most likes of their comments refer to Max(likes)
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What city does the business came from where they received a high volume of check-ins from 12 am to 1 am on 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'
12 am refers to opening_time = '12AM'; 1 am refers to closing_time = '1AM'; on Saturday refers to day_of_week = 'Saturday'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many businesses have shopping centers and received high review count?
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'
"Shopping Centers" is the category_name; high review count refers to review_count = 'High'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many businesses accept insurance?
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'
business that accept insurance refers to attribute_name = 'Accepts Insurance' AND attribute_value = 'true'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Calculate the average review star from users in businesses located in South Carolina and California state.
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 INNE...
"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))
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Compare and get the difference of the number of businesses that are open in Monday and Tuesday from 10 am to 9 pm.
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...
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')))
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
State the ID number for the attribute named "Accepts Insurance"?
SELECT attribute_id FROM Attributes WHERE attribute_name = 'Accepts Insurance'
ID number refers to attribute_id
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many actively running Yelp businesses are there located in "Phoenix" city?
SELECT COUNT(business_id) FROM Business WHERE active = 'true' AND city = 'Phoenix'
actively running business refers to active = 'true'; 'Phoenix' is the name of city
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Give the number of "4" stars Yelp businesses in "Mesa" city.
SELECT COUNT(business_id) FROM Business WHERE stars = 4 AND city = 'Mesa'
"4" stars refers to stars = '4'; 'Mesa' is the name of city
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Provide the number of Yelp businesses in "Gilbert" which got a" high" review count.
SELECT COUNT(business_id) FROM Business WHERE review_count = 'High' AND city = 'Gilbert'
"Gilbert" is the name of city; high review count refers to review_count = 'High'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Which actively running Yelp business in "Gilbert" has got the most reviews? Give the business id.
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'
actively running business refers to active = 'true'; 'Gilbert' is the name of city; most review refers to review_count = 'Uber'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
For the Yelp business in "Tempe" city which got "3.5" stars and review count as "Uber", how many "long" reviews did it get?
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'
"Tempe" is the name of city; long review refers to review_length = 'Long'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How is the "noise level" for the only Yelp business in “Mesa” which got a "Uber" review count?
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'
"Noise Level" is the attribute_name; 'Mesa' is the name of city
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Is the Yelp business No. 14033 good for supper?
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
business no. 14033 refers to business_id = 14033; good for supper refers to attribute_name = 'good_for_dinner'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How long is the Yelp business No. 15098 opened on 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
Yelp business No. 15098 refers to business_id = '15098'; Monday refers to day_of_week = 'Monday'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
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.
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'
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'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Which city is the business that got a "medium" length tip with "3" likes located in?
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
medium length tip refers to tip_length = 'Medium';
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
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?
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'
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'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many "cool" type compliments does user No. 41717 get?
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
"cool" type compliments refers to compliment_type = 'cool'; user No. 41717 refers to user_id = 41717
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Does Yelp business No."11825" have a "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'
business No."11825" refers to business_id = '12476'; have a "parking lot" refers to attribute_value = 'parking_lot'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Is the payment in mastercard possible for the Yelp business No."12476"?
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'
Yelp business No."12476" refers to business_id = '12476'; payment in mastercard refers to attribute_value = 'payment_types_mastercard'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
What is the percentage for the Yelp businesses in "Pets" category of all businesses?
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
businesses in "Pets" category refers to category_name = 'Pets'; percentage refers to DIVIDE(COUNT(category_name = 'Pets'), COUNT(business_id)) * 100%
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many times is the number of "Women's Clothing" Yelp businesses to "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
"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'))
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Write down the ID, active status and city of the business which are in CA state.
SELECT business_id, active, city FROM Business WHERE state = 'CA' AND active = 'true'
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
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Calculate the percentage of running business among all business.
SELECT CAST(SUM(CASE WHEN active = 'true' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(business_id) FROM Business
running business refers to active = 'true'; percentage refers to DIVIDE(COUNT(active = 'true'), COUNT(business_id)) * 100%
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Among all attribute names, list down the ID and attribute name which start with "music".
SELECT attribute_id, attribute_name FROM Attributes WHERE attribute_name LIKE 'music%'
attribute name which start with "music" refers to attribute_name LIKE 'music%'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Between 2006 and 2007, which year ID had the greater number in elite user?
SELECT year_id FROM Elite WHERE year_id IN (2006, 2007) GROUP BY year_id ORDER BY COUNT(user_id) DESC LIMIT 1
2006 and 2007 refers to BETWEEN 2006 AND 2007; greater number in elite user refers to count(user_id)
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Based on all user compliments, find the percentage of low number of compliments on all compliments ID.
SELECT CAST(SUM(CASE WHEN number_of_compliments = 'Low' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(user_id) FROM Users_compliments
low number of compliments refers to number_of_compliments = 'Low'; percentage refers to DIVIDE(COUNT(number_of_compliments = 'Low'), COUNT(user_id)) * 100
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List down the business ID and user ID who got uber for cool votes.
SELECT business_id, user_id FROM Reviews WHERE review_votes_cool = 'Uber'
got uber for cool votes refers to review_votes_cool = 'Uber'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Write the user ID, business ID and tips length of who started using Yelp since 2004 and had high followers.
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'
started using Yelp since 2004 refers to user_yelping_since_year = '2004'; had high followers refers to user_fans = 'High'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
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.
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'
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
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Under the attribute name of "music_playlist", describe the attribute ID, business ID, city and inactive status.
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'
active status refers to active; active = 'true' means the business is still running; active = 'false' means the business is inactive or not running now
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Calculate the percentage of business with attribute name of "Accepts Credit Cards".
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
percentage refers to DIVIDE(COUNT(attribute_name = 'Accepts Credit Cards'), COUNT(business_id))*100%
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Among the stopped businesses in San Tan Valley city, list down the user ID and review length of who had great experience.
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
stop businesses refers to active = 'false'; great experience refers to review_stars = 5
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Mention the user average star, elite year and the compliment type of user ID 6027 whereby number of compliments reach uber.
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...
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
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
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
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Describe category name which had above 10% in comparing with all business and categories.
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
above 10% refers to DIVIDE(COUNT(Business_Categories.business_id = category_id), COUNT(category_id)) * 100% > 10%
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
For the business with great experience existed in Sun Lakes city, provide the user ID who gave review on it and user followers.
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
with great experience refers to stars = 5
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Compare the number of business between the category of "Men's Clothing" and "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
category of "Men's Clothing" refers to category_name = 'Men''s Clothing'; "Women's Clothing" refers to category_name = 'Women''s Clothing'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Among highest quality user of under ID 100, mention compliment type which got highest compliment number and user's followers.
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
highest quality user refers to number_of_compliments = 'Uber'; user of under ID 100 refers to user_id < 100 ;
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List all the businesses that closed at 8PM.
SELECT DISTINCT business_id FROM Business_Hours WHERE closing_time = '8PM'
closed at 8PM refers to closing_time = '8PM';
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many 2 stars rated business located in Phoenix, Arizona?
SELECT COUNT(business_id) FROM Business WHERE city = 'Phoenix' AND state = 'AZ' AND stars = 2
located in Phoenix refers to city = 'Phoenix'; Arizona refers to state = 'AZ'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many businesses in Tempe are rated as 'Wonderful experience?
SELECT COUNT(business_id) FROM Business WHERE city = 'Phoenix' AND stars > 3
in Tempe refers to city = 'Tempe'; rated as 'Wonderful experience refers to stars > 3
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List all the users with average star less than 3 stars in 2012
SELECT user_id FROM Users WHERE user_yelping_since_year = 2012 AND user_average_stars < 3
average star less than 3 stars refers to user_average_stars < 3; in 2012 refers to user_yelping_since_year = 2012
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Find the percentage of 5 stars rated business.
SELECT CAST(SUM(CASE WHEN stars = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(stars) FROM Business
percentage refers to DIVIDE(COUNT(stars = 5), COUNT(business_id)) * 100%
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Calculate difference between business that have the highest number of reviews and business that have the lowest number of reviews.
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
highest number of reviews refers to SUBTRACT(MAX(COUNT(business_id), MIN(COUNT(business_id))))
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List all the tires businesses that are opened everyday.
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 COU...
tires businesses refers to category_name = 'Tires'; opened everyday refers to COUNT(distinct opening_time) = 7;
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
Which users become an elite in 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
in 2012 refers to actual_year = 2012;
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
List the business ID of shopping business that have 4 stars ratings.
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
shopping business refers to category_name = 'Shopping'; 4 stars ratings refers to stars = 4
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many business have low check-in on Sunday at 10AM?
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'
on Sunday refers to day_of_week = 'Sunday'; low check-in at 10AM refers to label_time_10 = 'Low'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many businesses in Glendale are reviewed by user with the ID of 20241?
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
in Glendale refers to city = 'Glendale'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
State the locations of all Pet Services business.
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'
location refers to city; Pet Services business refers to category_name = 'Pet Services'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many photos type compliment given from users with high cool votes?
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'
photos type compliment refers to compliment_type = 'photos'; high cool votes refers to review_votes_cool = 'High'
public_review_platform
CREATE TABLE Attributes ( attribute_id INTEGER constraint Attributes_pk primary key, attribute_name TEXT ); CREATE TABLE Categories ( category_id INTEGER constraint Categories_pk primary key, category_name TEXT ); CREATE TABLE Compliments ( compliment_id...
【DB_ID】 public_review_platform 【Schema】 # Table: main.Attributes [ (attribute_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (attribute_name:TEXT, Examples: [Alcohol, Waiter Service, Delivery]) ] # Table: main.Business [ (business_id:INTEGER, Primary Key, Examples: [1, 2, 3]), (active:TEXT, Examples: [true, false]), (c...
How many closed businesses that have more than 10 attributes?
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 )
closed refers to active = 'false'; more than 10 attributes refers to count(attribute_id) > 10