db_id
stringclasses
68 values
question
stringlengths
24
325
evidence
stringlengths
0
580
SQL
stringlengths
23
728
public_review_platform
Mention the user ID and their year of joining Yelp who had great experience on business ID 143.
year of joining Yelp refers to user_yelping_since_year; great experience refers to Reviews where review_stars = 5;
SELECT T2.user_id, T2.user_yelping_since_year FROM Reviews AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.business_id = 143 AND T1.review_stars = 5
public_review_platform
Among the user ID with number in compliment of uber on profile, list any 5 user ID and the year when they join Yelp.
when join Yelp refers to user_yelping_since_year; compliment_type = 'profile'; number_of_compliments = 'Uber';
SELECT T3.user_id, T3.user_yelping_since_year FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T1.compliment_type = 'profile' AND T2.number_of_compliments = 'Uber' LIMIT 5
public_review_platform
List the user ID, business ID with review length of the business which received the most likes in tips.
business which received the most likes refers to business_id where MAX(likes);
SELECT T1.user_id, T1.business_id, T2.review_length FROM Tips AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id ORDER BY T1.likes DESC LIMIT 1
public_review_platform
Among the elite users of 10 consecutive year from 2005 to 2014, list down the user ID and their number of compliment on photos.
from 2005 to 2014 refers to year_id BETWEEN 2005 AND 2014; compliment_type = 'photos';
SELECT T2.user_id, T2.number_of_compliments FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id INNER JOIN Elite AS T3 ON T2.user_id = T3.user_id WHERE T3.year_id BETWEEN 2005 AND 2014 AND T1.compliment_type = 'photos'
public_review_platform
Calculate the percentage of business which opened on Sunday from 9AM to 9PM based on the number of business opened on Sunday.
Sunday refers to day_of_week = 'Sunday' where day_id = 1; opened from 9AM to 9PM refers to Business_Hours where opening_time = '9AM' and closing_time = '9PM'; DIVIDE(COUNT(opening_time = '9AM' and closing_time = '9PM' and day_of_week = 'Sunday'), COUNT(opening_time = NOT NULL and closing_time = NOT NULL and day_of_week = 'Sunday')) as percentage;
SELECT CAST(SUM(CASE WHEN T2.opening_time = '9AM' AND T2.closing_time = '9PM' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.day_id) FROM Days AS T1 INNER JOIN Business_Hours AS T2 ON T1.day_id = T2.day_id WHERE T1.day_of_week = 'Sunday'
public_review_platform
Write down the ID and opening day of a week for the business which are running in Black Canyon City.
running refers to active = 'true'; opening day of a week means days of the week when business is open;
SELECT T2.business_id, T3.day_of_week FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.city = 'Black Canyon City' AND T1.active = 'true'
public_review_platform
Which business ID received the review of 4 star and above by 65% of user? Describe their active status and city.
review of 4 star and above refers to stars > 4; DIVIDE(SUM(stars > 4), COUNT(business_id)) = 0.65;
SELECT DISTINCT T2.business_id, T2.city FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.review_stars >= 4 AND ( SELECT CAST(( SELECT COUNT(DISTINCT T1.user_id) FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.review_stars >= 4 ) AS REAL) * 100 / ( SELECT COUNT(user_id) FROM Users ) > 65 )
public_review_platform
Calculate the difference between running business in Glendale City and Mesa City.
running business refers to business where active = 'true';
SELECT SUM(CASE WHEN city = 'Glendale' THEN 1 ELSE 0 END) - SUM(CASE WHEN city = 'Mesa' THEN 1 ELSE 0 END) AS diff FROM Business WHERE active = 'true'
public_review_platform
How many likes did short comment left by users who joined in 2010 get?
short comment refers to tip_length = 'Short'; users who joined in 2010 refer to user_id where user_yelping_since_year = 2010;
SELECT SUM(T2.likes) FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_yelping_since_year = 2010
public_review_platform
Sum up the likes get by short reviews on businesses located in City Goodyear.
short reviews refer to tip_length = 'Short';
SELECT SUM(T2.likes) AS likes FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Goodyear'
public_review_platform
For businesses with long length reviews, which state are they located?
businesses with long length tips refer to business_id where tip_length = 'Long';
SELECT DISTINCT T1.state FROM Business AS T1 INNER JOIN Tips AS T2 ON T1.business_id = T2.business_id WHERE T2.tip_length = 'Long'
public_review_platform
List down the category of businesses whose stars ratings are 5.
category of businesses refers to category_name; stars ratings are 5 refers to stars = 5
SELECT DISTINCT T3.category_name FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T1.stars = 5
public_review_platform
What are the states of businesses with attribute of beer and wine located?
with attribute of beer and wine refers to attribute_value = 'beer_and_wine';
SELECT DISTINCT T2.state FROM Business_Attributes AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.attribute_value = 'beer_and_wine'
public_review_platform
How many user's compliment in photo has medium in number?
user's compliment in photo refers to compliment_type = 'photo'; photo has medium in number refers to number_of_compliments = 'Medium'
SELECT COUNT(T2.user_id) FROM Compliments AS T1 INNER JOIN Users_Compliments AS T2 ON T1.compliment_id = T2.compliment_id WHERE T1.compliment_type = 'photos' AND T2.number_of_compliments = 'Medium'
public_review_platform
Sum up the number of business with "ambience_romantic" attribute.
"ambience_romantic" attribute refers to attribute_name = 'ambience_romantic' AND attribute_value = 'true'
SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name = 'ambience_romantic' AND T2.attribute_value = 'true'
public_review_platform
What is the percentage of businesses with "Good for Kids" attribute over the other attributes?
"Good for Kids" attribute refers to attribute_name = 'Good for Kids' AND attribute_value = 'true'; Calculation = DIVIDE(SUM(attribute_name = 'Good for Kids' AND attribute_value = 'true')), SUM(business_id) * 100
SELECT CAST(SUM(CASE WHEN attribute_name = 'Good for Kids' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.attribute_value = 'true'
public_review_platform
How many businesses are not closed in the city of Mesa?
businesses are not closed refers to active = 'true'
SELECT COUNT(business_id) FROM Business WHERE city = 'Mesa' AND active = 'true'
public_review_platform
In how many businesses have customers had a bad or terrible experience?
stars = 2 means bad experience; stars = 1 means terrible experience; customers had a bad or terrible experience refers to stars = 2 OR stars = 1
SELECT COUNT(business_id) FROM Business WHERE stars IN (1, 2)
public_review_platform
List by ID the businesses with the reviews with the lowest veracity of Paradise Valley.
ID of businesses refers to business_id; reviews with the lowest veracity refers to review_count = 'Low' AND stars > 3; Paradise Valley is a city
SELECT business_id FROM Business WHERE stars > 3 AND city = 'Paradise Valley' AND review_count = 'Low'
public_review_platform
How many businesses are opened the same number of hours every day of the week?
how much time does this business open refers to SUBTRACT(closing_time, opening_time); every day of the week refers to day_id BETWEEN 1 AND 7
SELECT COUNT(business_id) FROM Business_Hours WHERE opening_time = '8AM' AND closing_time = '6PM'
public_review_platform
How many reviews of businesses that are still open received an uber rating on the funny vote?
businesses that still open refers to active = 'true'; business received an uber rating on the funny vote refers to review_votes_funny = 'Uber'
SELECT COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Reviews AS T2 ON T1.business_id = T2.business_id WHERE T2.review_votes_funny = 'Uber' AND T1.active = 'true'
public_review_platform
How many of the users who use a high number of compliments do not have any fans?
do not have fans refers to user_fans = 'None'; high number of compliment refers to number_of_compliments = 'High'
SELECT COUNT(T2.user_id) FROM Users_Compliments AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.number_of_compliments = 'High' AND T2.user_fans = 'None'
public_review_platform
What is the most common type of compliments that a user has received from other users?
the most common type of compliments refers to MAX(COUNT(compliment_type))
SELECT T2.compliment_type FROM Users_Compliments AS T1 INNER JOIN Compliments AS T2 ON T1.compliment_id = T2.compliment_id GROUP BY T2.compliment_type ORDER BY COUNT(T2.compliment_type) DESC LIMIT 1
public_review_platform
How many stars does each of the 3 top users with the most likes in their reviews have?
more likes mean this tip is more valuable; the most likes refers to MAX(likes); stars refers to users_average_stars
SELECT T2.user_average_stars FROM Tips AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id GROUP BY T2.user_id ORDER BY SUM(T1.likes) DESC LIMIT 3
public_review_platform
In which categories does the only business located in the city of Arcadia appear?
categories refers to category_name
SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.city = 'Arcadia'
public_review_platform
List by their id all businesses that are open on Sunday.
day_of_week = 'Sunday'; open on Sunday refers to day_id = 1
SELECT T1.business_id FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T1.day_id = 1
public_review_platform
How many businesses with music_karaoke attribute are closed?
music_karaoke attribute refers to attribute_name = 'music_karaoke' AND attribute_value = 'true'; businesses are closed refers to active = 'false'
SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name = 'music_karaoke' AND T3.active = 'false' AND T2.attribute_value IN ('none', 'no', 'false')
public_review_platform
How many open businesses in the City of Phoenix have users left a long review?
open businesses refers to active = 'true'; long review refers to review_length = 'Long'
SELECT COUNT(DISTINCT T2.business_id) FROM Reviews AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id WHERE T1.review_length = 'Long' AND T2.active = 'true' AND T2.city = 'Phoenix'
public_review_platform
How many users who have received a low cool vote have also received at least 1 low cool vote for some of their reviews?
low cool vote for user refers to user_votes_cool = 'Low';  low cool vote for review refers to review_votes_cool = 'Low'
SELECT COUNT(DISTINCT T1.user_id) FROM Users AS T1 INNER JOIN Reviews AS T2 ON T1.user_id = T2.user_id WHERE T1.user_votes_cool = 'Low' AND T2.review_votes_cool = 'Low'
public_review_platform
How many users with a long tip and 2 likes for their tip have a high number of fans?
long tip refers to tip_length = 'Long'; 2 likes refers to likes = 2; high number of fans refers to user_fans = 'High'
SELECT COUNT(DISTINCT T1.user_id) FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T2.tip_length = 'Long' AND T2.likes = 2 AND T1.user_fans = 'High'
public_review_platform
In how many businesses with the ambience_trendy attribute?
ambience_trendy attribute refers to attribute_name = 'ambience_trendy' AND attribute_value = 'false'
SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name = 'ambience_trendy' AND T2.attribute_value IN ('none', 'no', 'false')
public_review_platform
How many businesses in the city of Scottsdale open on Sunday at 12PM?
businesses that opened on Sunday refers to day_of_week = 'Sunday'; businesses that opened at 12PM refers to opening_time = '12PM'
SELECT COUNT(DISTINCT T2.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 = 'Scottsdale' AND T3.day_of_week = 'Sunday' AND T2.opening_time = '12PM'
public_review_platform
What is the average number of stars for businesses in the Obstetricians & Gynecologists category?
Obstetricians & Gynecologists category refers to category_name = 'Obstetricians & Gynecologists'; calculation = AVG(stars)
SELECT CAST(SUM(T1.stars) AS REAL) / COUNT(T1.business_id) FROM Business AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T3.category_name = 'Obstetricians & Gynecologists'
public_review_platform
Calculate the percentage of users with a high number of fans who were elite in 2011.
users with a high number of fans refers to user_fans = 'High'; 2011 refers to actual_year = 2011; Calculation = DIVIDE(Elite.user_id where user_fans = 'High' AND actual_year = 2011, Elite.user_id where actual_year = 2011) * 100
SELECT CAST(SUM(CASE WHEN T3.user_fans = 'High' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T3.user_fans) FROM Years AS T1 INNER JOIN Elite AS T2 ON T1.year_id = T2.year_id INNER JOIN Users AS T3 ON T2.user_id = T3.user_id WHERE T1.actual_year = 2011
public_review_platform
How many of the businesses are in Surprise?
Surprise is a city
SELECT COUNT(business_id) FROM Business WHERE city = 'Surprise'
public_review_platform
List down the business ID with a high review count in Tempe.
Tempe is a city; high review count refers to review_count = 'High'
SELECT business_id FROM Business WHERE review_count = 'High' AND city = 'Tempe'
public_review_platform
What is the total number of active businesses in AZ with a medium review count?
active businesses refers to active = 'true'; AZ is a state; medium review count refers to review_count = 'Medium'
SELECT COUNT(business_id) FROM Business WHERE review_count = 'Medium' AND state = 'AZ' AND active = 'true'
public_review_platform
List down the business ID with a star range from 3 to 5, located at Chandler.
businesses with a star range from 3 to 5 refers to stars BETWEEN 3 AND 5; Chandler is a city
SELECT business_id FROM Business WHERE stars >= 3 AND stars < 6 AND city = 'Chandler'
public_review_platform
In users yelping since 2009 to 2011, how many of them have low count of fans?
users in yelping since 2009 to 2011 refers to user_yelping_since_year BETWEEN 2009 AND 2011; low count of fans refers to user_fans = 'Low'
SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year >= 2009 AND user_yelping_since_year < 2012 AND user_fans = 'Low'
public_review_platform
What is the review length of user 11021 to business with business ID 3?
review length refers to review_length; user 11021 refers to user_id = 11021; business ID 3 refers to business_id = 3
SELECT review_length FROM Reviews WHERE user_id = 11021 AND business_id = 3
public_review_platform
Among the businesses in Tempe, list the attribute of the business with a medium review count.
Tempe is a city; high review count refers to review_count = 'High'
SELECT DISTINCT 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 = 'Tempe' AND T1.review_count = 'Medium'
public_review_platform
In businesses with a category of food, how many of them have a star rating below 3?
category of food refers to category_name = 'Food'; star rating below 3 refers to stars < 3
SELECT COUNT(DISTINCT 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 = 'Food' AND T1.stars < 3
public_review_platform
List the active business ID and its stars of the businesses fall under the category of Food.
active business ID refers to active = 'true'; category of Food refers to category_name = 'Food'
SELECT DISTINCT T1.business_id, T1.stars 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 = 'Food' AND T1.active = 'true'
public_review_platform
What is the category and attributes of businesses with highest star rating?
category of the business refers to category_name; attributes of the business refers to attribute_name; the highest star rating refers to MAX(stars)
SELECT DISTINCT T3.category_name, T5.attribute_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 INNER JOIN Business_Attributes AS T4 ON T2.business_id = T4.business_id INNER JOIN Attributes AS T5 ON T4.attribute_id = T5.attribute_id WHERE T1.stars = ( SELECT MAX(stars) FROM Business )
public_review_platform
What is the category of the business with short review length and highest review stars within business ID from 7 to 14?
category of the business refers to category_name; short review length refers to review_length = 'Short'; the highest star rating refers to MAX(stars); business ID from 7 to 14 refers to business_id BETWEEN 7 AND 14
SELECT DISTINCT T3.category_name FROM Reviews AS T1 INNER JOIN Business_Categories AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T2.category_id = T3.category_id WHERE T2.business_id >= 7 AND T2.business_id < 15 AND T1.review_length = 'Short' AND T1.review_stars = ( SELECT MAX(review_stars) FROM Reviews )
public_review_platform
Count the active businesses that has an attribute of BYOB with high review count.
active business ID refers to active = 'true'; category of Food refers to category_name = 'Food'; attribute of BYOB refers to attribute_name = 'BYOB'; high review count refers to review_count = 'High'
SELECT COUNT(DISTINCT 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 = 'BYOB' AND T1.review_count = 'High' AND T1.active = 'true'
public_review_platform
What is the closing and opening time of businesses located at Glendale with highest star rating?
Glendale is a city; the highest star rating refers to MAX(stars)
SELECT T2.opening_time, T2.closing_time FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'Glendale' ORDER BY T1.stars DESC LIMIT 1
public_review_platform
List the categories of active businesses in Glendale, AZ.
active business ID refers to active = 'true'; categories refers to category_name; Glendale is a city; AZ is a state
SELECT DISTINCT T3.category_name FROM Business_Categories AS T1 INNER JOIN Business AS T2 ON T1.business_id = T2.business_id INNER JOIN Categories AS T3 ON T1.category_id = T3.category_id WHERE T2.active = 'true' AND T2.state = 'AZ' AND T2.city = 'Glendale'
public_review_platform
Find the location of businesses that has business hours from 7 am to 7 pm every Wednesday.
location of business refers to city; business hours from 7am to 7pm refers to opening_time = '7AM' AND closing_time = '7PM'; Wednesday refers to day_of_week = 'Wednesday'
SELECT DISTINCT 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 = '7AM' AND T2.closing_time = '7PM' AND T3.day_of_week = 'Wednesday'
public_review_platform
What is the attribute value of an active business with a low review count and 3 stars which is located at Goodyear, AZ?
active business ID refers to active = 'true'; low review count refers to review_count = 'Low'; 3 stars refers to stars = 3; Goodyear is a city; AZ is a state
SELECT DISTINCT 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 = 'AZ' AND T1.city = 'Goodyear' AND T1.active = 'true' AND T1.stars = 3 AND T1.review_count = 'Low'
public_review_platform
What is the opening time of the active businesses in Glendale that have a medium review count.
active business ID refers to active = 'true'; Glendale is a city; medium review count refers to review_count = 'Medium'
SELECT DISTINCT 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 = 'Glendale' AND T1.review_count = 'Medium' AND T1.active = 'true'
public_review_platform
Among the businesses with a category of Food, what is the percentage of the business with greater than 3 stars?
category of food refers to category_name = 'Food'; calculation = DIVIDE(COUNT(stars > 3), SUM(stars))
SELECT CAST(SUM(CASE WHEN T1.stars > 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.stars) 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 = 'Food'
public_review_platform
List the closing time and day of week of active businesses in Goodyear with stars greater than the 80% of average age of star rating.
active business ID refers to active = 'true'; Goodyear is a city; Calculation = AVG(stars) * 0.8; businesses with stars greater than 80% of average star rating refers to stars > AVG(stars) * 0.8
SELECT DISTINCT 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.active = 'true' AND T1.city = 'Goodyear' AND T1.stars > ( SELECT AVG(stars) * 0.8 FROM Business WHERE active = 'true' AND city = 'Goodyear' )
citeseer
Among all the citation, what is the percentage of paper ID under the Agents classification?
classification refers to class_label; class_label = 'Agents'; percentage = (divide(count(paper_id where class_label = 'Agents')), (count(paper_id)))*100;
SELECT CAST(COUNT(CASE WHEN class_label = 'Agents' THEN paper_id ELSE NULL END) AS REAL) * 100 / COUNT(paper_id) FROM paper
citeseer
What is the most cited word? How many papers was that word cited in?
most cited word refers to max(count(word_cited_id);
SELECT word_cited_id, COUNT(paper_id) FROM content GROUP BY word_cited_id ORDER BY COUNT(word_cited_id) DESC LIMIT 1
citeseer
What is the total number of word cited under that class labelled 'AI'?
SELECT COUNT(DISTINCT T2.word_cited_id) FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'AI'
citeseer
Among all the DB class type citation, which word is the most frequently cited?
class type refers to class_label; class_label = 'DB'; word that is most frequently cited refers to max(count(word_cited_id);
SELECT T2.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'DB' GROUP BY T2.word_cited_id ORDER BY COUNT(T2.word_cited_id) DESC LIMIT 1
citeseer
Calculate the percentage of words used in Agents class label.
percentage = (divide(count(word_cited_id where class_label = 'Agents')), (count(word_cited_id)))*100;
SELECT CAST(COUNT(DISTINCT CASE WHEN T1.class_label = 'Agents' THEN T2.word_cited_id ELSE NULL END) AS REAL) * 100 / COUNT(DISTINCT T2.word_cited_id) FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id
citeseer
Which paper ID cited the most word? In which class label does it belongs to?
most cited word refers to max(word_cited_id);
SELECT T1.paper_id, T1.class_label FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id GROUP BY T1.paper_id, T1.class_label ORDER BY COUNT(T2.word_cited_id) DESC LIMIT 1
citeseer
List all the paper ID and its class type that cited the word 'word1002'.
class type refers to class_label;
SELECT T1.paper_id, T1.class_label FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T2.word_cited_id = 'word1002'
citeseer
List all words cited in the AI class label.
SELECT DISTINCT T2.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'AI'
citeseer
What is the class label of paper ID 'chakrabarti01integrating'. How many words were cited by this paper ID?
SELECT DISTINCT T1.class_label, COUNT(T2.word_cited_id) FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.paper_id = 'chakrabarti01integrating' GROUP BY T1.class_label
citeseer
List the words that are cited in both AI and IR class label.
SELECT DISTINCT T2.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'AI' OR T1.class_label = 'IR'
citeseer
Name the paper which is cited most times and the paper which is cited least times? Also, find the number of times each one is cited.
SELECT cited_paper_id, COUNT(cited_paper_id), ( SELECT cited_paper_id FROM cites GROUP BY cited_paper_id ORDER BY COUNT(cited_paper_id) ASC LIMIT 1 ), ( SELECT COUNT(cited_paper_id) FROM cites GROUP BY cited_paper_id ORDER BY COUNT(cited_paper_id) ASC LIMIT 1 ) FROM cites GROUP BY cited_paper_id ORDER BY COUNT(cited_paper_id) DESC LIMIT 1
citeseer
On average, how many papers are under the ML class?
class refers to class_label; average = divide(count(paper_id where class_label = 'M')), (count(paper_id)));
SELECT CAST(COUNT(CASE WHEN class_label = 'ML' THEN paper_id ELSE NULL END) AS REAL) / COUNT(paper_id) FROM paper
citeseer
Find the words cited in papers that are cited by sima01computational?
paper cited by refers to citing_paper_id; citing_paper_id = 'sima01computational';
SELECT DISTINCT T2.word_cited_id FROM cites AS T1 INNER JOIN content AS T2 ON T1.cited_paper_id = T2.paper_id WHERE T1.citing_paper_id = 'sima01computational'
citeseer
How many papers were cited by schmidt99advanced cited word3555?
paper cited by refers to citing_paper_id; citing_paper_id = 'schmidt99advanced';
SELECT COUNT(T2.paper_id) FROM cites AS T1 INNER JOIN content AS T2 ON T1.cited_paper_id = T2.paper_id WHERE T1.citing_paper_id = 'schmidt99advanced' AND T2.word_cited_id = 'word3555'
citeseer
Under what classification do the papers that cited word1163 belong?
SELECT DISTINCT T1.class_label FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T2.word_cited_id = 'word1163'
citeseer
Among the papers under DB classification, which paper has the highest number of words cited?
classification refers to class_label; class_label = 'DB';
SELECT T1.paper_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.class_label = 'DB' GROUP BY T1.paper_id ORDER BY COUNT(T2.word_cited_id) DESC LIMIT 1
citeseer
In the papers classified as ML, how many cited butz01algorithmic?
classification refers to class_label; paper cited by refers to citing_paper_id; citing_paper_id = 'butz01algorithmic';
SELECT COUNT(T1.paper_id) FROM paper AS T1 INNER JOIN cites AS T2 ON T1.paper_id = T2.citing_paper_id WHERE T1.class_label = 'ML' AND T2.cited_paper_id = 'butz01algorithmic'
simpson_episodes
Which crew member of the simpson 20s is the oldest?
oldest refers to Min(birthdate)
SELECT name FROM Person WHERE birthdate IS NOT NULL ORDER BY birthdate ASC LIMIT 1;
simpson_episodes
What's the nickname for Dan Castellaneta?
"Dan Castellaneta" is the name of Person
SELECT nickname FROM Person WHERE name = 'Dan Castellaneta';
simpson_episodes
Among the crew members of the simpson 20s born in the New York city, how many of them were born after the year 1970?
born in New York city refers to birth_region = 'New York'; born after year 1970 refers to ('%Y', birthdate) > 1970
SELECT COUNT(name) FROM Person WHERE birth_region = 'New York' AND SUBSTR(birthdate, 1, 4) > '1970';
simpson_episodes
In which country was the winner of the Outstanding Voice-Over Performance award of 2009 born?
"Outstanding Voice-Over Performance" is the award; 2009 refers to year = 2009; 'Winner' is the result; country refers to birth_country
SELECT T1.birth_country FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.award = 'Outstanding Voice-Over Performance' AND T2.year = 2009 AND T2.result = 'Winner';
simpson_episodes
Please list the names of all the awards won by the crew member whose nickname is Doofus.
award won refers to result = 'Winner'
SELECT T2.award FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T1.nickname = 'Doofus' AND T2.result = 'Winner';
simpson_episodes
How many crew members who were born in the USA were nominated for the Outstanding Animated Program (For Programming Less Than One Hour) award in 2009?
born in USA refers to birth_country = 'USA'; were nominated refers to result = 'Nominee'; 'Outstanding Animated Program (For Programming Less Than One Hour)' is the award; in 2009 refers to year = 2009
SELECT COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T1.birth_country = 'USA' AND T2.result = 'Nominee' AND T2.award = 'Outstanding Animated Program (For Programming Less Than One Hour)' AND T2.year = 2009;
simpson_episodes
Which character won the Outstanding Voice-Over Performance award in 2009?
won refers to result = 'Winner'
SELECT DISTINCT T1.character FROM Character_Award AS T1 INNER JOIN Award AS T2 ON T1.award_id = T2.award_id WHERE T2.award = 'Outstanding Voice-Over Performance' AND T2.year = 2009 AND T2.result = 'Winner';
simpson_episodes
Please list all the keywords of the episode Lost Verizon.
"Lost Verizon" is the title of episode
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Lost Verizon';
simpson_episodes
How many keywords does the episode that was aired on 2008/10/19 have?
aired on 2008/10/19 refers to air_date = '2008-10-19'
SELECT COUNT(T2.keyword) FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.air_date = '2008-10-19';
simpson_episodes
How many 7-star votes in star score did the episode Lost Verizon have?
7-stars vote refers to stars = 7; 'Lost Verizon' is the title of episode
SELECT COUNT(*) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Lost Verizon' AND T2.stars = 7;
simpson_episodes
How many stars did most of the voters give in star score for the episode Lost Verizon?
"Lost Verizon" is the title of episode; most voters refers to Max(votes)
SELECT T2.stars FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Lost Verizon' ORDER BY T2.votes DESC LIMIT 1;
simpson_episodes
Please list the titles of the episodes that have over 200 voters voting a 10 in star score.
over 200 votes refers to votes > 200; 10 in star score refers to stars = 10
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.votes > 200 AND T2.stars = 10;
simpson_episodes
How many episodes aired in the year 2009 have over 15% of voters giving 10 stars in star score?
aired in the year 2009 refers to air_date like '2009%'; 10 stars in star score refers to stars = 10; over 15% of voters refers to Votes.percent > 15
SELECT COUNT(*) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2009' AND T2.stars = 10 AND T2.percent > 15;
simpson_episodes
What's the title of the episode that got the most 7-star votes in star score?
7-stars vote refers to stars = 7;  most refers to Max(votes)
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 7 ORDER BY T2.votes DESC LIMIT 1;
simpson_episodes
How many stars on average does the episode Lost Verizon have?
"Lost Verizon" is the title of episode; stars on average = Divide( Sum (Multiply (votes, stars)), Sum(votes))
SELECT CAST(SUM(T2.votes * T2.stars) AS REAL) / SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Lost Verizon';
simpson_episodes
What is the percentage of Primetime Emmy nominated episodes with a rating over 7 to all the episodes that have a rating over 7?
"Primetime Emmy' is the award_category;  rating over 7 refers to rating > 7; nominated refers to result = 'Nominee'; percentage = Divide(Count(episode_id(award_category = 'Primetime Emmy')), Count (episode_id)) * 100
SELECT CAST(SUM(CASE WHEN T1.award_category = 'Primetime Emmy' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.rating > 7 AND T1.result = 'Nominee';
simpson_episodes
Name the title of the episode where Pamela Hayden voiced the character 'Ruthie.'
"Pamela Hayden" is the person; voice the character 'Ruthie' refers to role = 'Ruthie'
SELECT T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Pamela Hayden' AND T2.role = 'Ruthie';
simpson_episodes
List down all the roles of Matt Groening on the episode titled 'In the Name of the Grandfather' along with the episode number and series number.
"Matt Groening" is the person; 'In the Name of the Grandfather' is the title of episode; episode number refers to episode; series number refers to number_in_series
SELECT T2.role, T1.episode, T1.number_in_series FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Matt Groening' AND T1.title = 'In the Name of the Grandfather';
simpson_episodes
Write down the title and summary of the episode with the keyword 'eviction.'
SELECT T1.title, T1.summary FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword = 'eviction';
simpson_episodes
What is the average number of stars received by the episode titled 'Wedding for Disaster.'
"Wedding for Disaster" is the title of episode; average number of stars = Divide(Sum(stars), Count(stars))
SELECT AVG(T2.stars) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Wedding for Disaster';
simpson_episodes
Write the title and all the keywords of the episode that was aired on 3/22/2009.
aired on 3/22/2009 refers to air_date = '2009-03-22'
SELECT T1.title, T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.air_date = '2009-03-22';
simpson_episodes
What is the birth name of the person who voiced 'Helen Lovejoy?'
voiced refers to role; role = 'Helen Lovejoy"
SELECT DISTINCT T1.birth_name FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T2.role = 'Helen Lovejoy';
simpson_episodes
How many episodes have more than 1000 votes?
more than 1000 votes refers to votes > 1000
SELECT COUNT(episode_id) FROM Episode WHERE votes > 1000;
simpson_episodes
How many persons were born in New York, USA?
"New York" is the birth_place; 'USA' is the birth_region
SELECT COUNT(name) FROM Person WHERE birth_place = 'New York City' AND birth_country = 'USA';
simpson_episodes
List the name of all awards along with the award category, nominated by Marc Wilmore.
"Marc Wilmore" is the name of person
SELECT award_id, award_category FROM Award WHERE person = 'Marc Wilmore';
simpson_episodes
How many crew have their own nickname? List their full name along with the nickname.
crew refers to Person; full name refers to name; have nickname refers to nickname IS NOT NULL
SELECT COUNT(name) FROM Person WHERE nickname IS NOT NULL;
simpson_episodes
Find the average height for each person.
average high = Divide(Sum(height_meters), Count(name))
SELECT AVG(height_meters) FROM Person;
simpson_episodes
Calculate the difference between the highest votes for episode and the lowest votes for episode.
highest vote refers to Max(votes); lowest vote refers to Min(votes); difference = Subtract(Max(votes), Min(votes))
SELECT MAX(votes) - MIN(votes) FROM Vote;
simpson_episodes
List the name character awarded for the Outstanding Voice-Over Performance award in 2009.
in 2009 refers to year = 2009
SELECT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.year = 2009 AND T1.award = 'Outstanding Voice-Over Performance';
simpson_episodes
Among the person nominated for the Comedy Series Award in 2009, how many of them were born in California?
nominated refers to result = 'Nominee'; born in California refers to birth_place = 'California'; in 2009 refers to year = 2009
SELECT COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.year = 2009 AND T2.award = 'Comedy Series' AND T1.birth_region = 'California';