problem
stringlengths 121
422
| db_id
stringclasses 69
values | solution
stringlengths 23
804
|
---|---|---|
Write SQL query to solve given problem: Calculate the difference between running business in Glendale City and Mesa City.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How many likes did short comment left by users who joined in 2010 get?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: For users with average ratings of 3, what kind of tip length they mostly left?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T2.tip_length FROM Users AS T1 INNER JOIN Tips AS T2 ON T1.user_id = T2.user_id WHERE T1.user_average_stars = 3 GROUP BY T2.tip_length ORDER BY COUNT(T2.tip_length) DESC LIMIT 1 |
Write SQL query to solve given problem: Sum up the likes get by short reviews on businesses located in City Goodyear.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: For businesses with long length reviews, which state are they located?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How much time do businesses in El Mirage City, AZ State operate in average daily?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT SUM(T2.closing_time - T2.opening_time) FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id WHERE T1.city = 'El Mirage' AND T1.state = 'AZ' |
Write SQL query to solve given problem: List down the closing day of businesses located at SC State.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T3.day_id - T2.day_id FROM Business AS T1 INNER JOIN Business_Hours AS T2 ON T1.business_id = T2.business_id INNER JOIN Days AS T3 ON T2.day_id = T3.day_id WHERE T1.state = 'SC' |
Write SQL query to solve given problem: List down the category of businesses whose stars ratings are 5.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: What are the states of businesses with attribute of beer and wine located?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How many user's compliment in photo has medium in number?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: Among businesses with "Wi-Fi" attribute, which businesses id are located at SC State?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T3.business_id FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name = 'Wi-Fi' AND T2.attribute_value = 'true' AND T3.state = 'SC' |
Write SQL query to solve given problem: Sum up the number of business with "ambience_romantic" attribute.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name = 'ambience_romantic' AND T2.attribute_value = 'true' |
Write SQL query to solve given problem: What is the percentage of businesses with "Good for Kids" attribute over the other attributes?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How many businesses are not closed in the city of Mesa?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE city = 'Mesa' AND active = 'true' |
Write SQL query to solve given problem: In how many businesses have customers had a bad or terrible experience?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE stars IN (1, 2) |
Write SQL query to solve given problem: List by ID the businesses with the reviews with the lowest veracity of Paradise Valley.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT business_id FROM Business WHERE stars > 3 AND city = 'Paradise Valley' AND review_count = 'Low' |
Write SQL query to solve given problem: How many businesses have more than 1 attribute?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business_Attributes WHERE attribute_value > 1 |
Write SQL query to solve given problem: How many businesses are opened the same number of hours every day of the week?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business_Hours WHERE opening_time = '8AM' AND closing_time = '6PM' |
Write SQL query to solve given problem: How many reviews of businesses that are still open received an uber rating on the funny vote?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How many of the users who use a high number of compliments do not have any fans?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: What is the most common type of compliments that a user has received from other users?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: How many stars does each of the 3 top users with the most likes in their reviews have?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: In which categories does the only business located in the city of Arcadia appear?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.category_name FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T3.city = 'Arcadia' |
Write SQL query to solve given problem: List by their id all businesses that are open on Sunday.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT T1.business_id FROM Business_Hours AS T1 INNER JOIN Days AS T2 ON T1.day_id = T2.day_id WHERE T1.day_id = 1 |
Write SQL query to solve given problem: How many businesses with music_karaoke attribute are closed?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id INNER JOIN Business AS T3 ON T2.business_id = T3.business_id WHERE T1.attribute_name = 'music_karaoke' AND T3.active = 'false' AND T2.attribute_value IN ('none', 'no', 'false') |
Write SQL query to solve given problem: How many open businesses in the City of Phoenix have users left a long review?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How many users who have received a low cool vote have also received at least 1 low cool vote for some of their reviews?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: How many users with a long tip and 2 likes for their tip have a high number of fans?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: In how many businesses with the ambience_trendy attribute?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name = 'ambience_trendy' AND T2.attribute_value IN ('none', 'no', 'false') |
Write SQL query to solve given problem: How many businesses in the city of Scottsdale open on Sunday at 12PM?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: What is the average number of stars for businesses in the Obstetricians & Gynecologists category?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: Calculate the percentage of users with a high number of fans who were elite in 2011.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: How many of the businesses are in Surprise?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE city = 'Surprise' |
Write SQL query to solve given problem: List down the business ID with a high review count in Tempe.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT business_id FROM Business WHERE review_count = 'High' AND city = 'Tempe' |
Write SQL query to solve given problem: What is the total number of active businesses in AZ with a medium review count?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(business_id) FROM Business WHERE review_count = 'Medium' AND state = 'AZ' AND active = 'true' |
Write SQL query to solve given problem: List down the business ID with a star range from 3 to 5, located at Chandler.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT business_id FROM Business WHERE stars >= 3 AND stars < 6 AND city = 'Chandler' |
Write SQL query to solve given problem: In users yelping since 2009 to 2011, how many of them have low count of fans?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT COUNT(user_id) FROM Users WHERE user_yelping_since_year >= 2009 AND user_yelping_since_year < 2012 AND user_fans = 'Low' |
Write SQL query to solve given problem: What is the review length of user 11021 to business with business ID 3?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT review_length FROM Reviews WHERE user_id = 11021 AND business_id = 3 |
Write SQL query to solve given problem: Among the businesses in Tempe, list the attribute of the business with a medium review count.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: In businesses with a category of food, how many of them have a star rating below 3?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: List the active business ID and its stars of the businesses fall under the category of Food.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: What is the category and attributes of businesses with highest star rating?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 ) |
Write SQL query to solve given problem: What is the category of the business with short review length and highest review stars within business ID from 7 to 14?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 ) |
Write SQL query to solve given problem: Count the active businesses that has an attribute of BYOB with high review count.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: What is the closing and opening time of businesses located at Glendale with highest star rating?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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 |
Write SQL query to solve given problem: Among the active businesses located at Goodyear, AZ, list the category and atrributes of business with a high review count.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | SELECT 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 T1.business_id = T4.business_id INNER JOIN Attributes AS T5 ON T4.attribute_id = T5.attribute_id WHERE T1.review_count = 'High' AND T1.city = 'Goodyear' AND T1.state = 'AZ' AND T1.active = 'true' |
Write SQL query to solve given problem: List the categories of active businesses in Glendale, AZ.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: Find the location of businesses that has business hours from 7 am to 7 pm every Wednesday.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: What is the attribute value of an active business with a low review count and 3 stars which is located at Goodyear, AZ?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: What is the opening time of the active businesses in Glendale that have a medium review count.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: Among the businesses with a category of Food, what is the percentage of the business with greater than 3 stars?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' |
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | public_review_platform | 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' ) |
Write SQL query to solve given problem: Among all the citation, what is the percentage of paper ID under the Agents classification?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | SELECT CAST(COUNT(CASE WHEN class_label = 'Agents' THEN paper_id ELSE NULL END) AS REAL) * 100 / COUNT(paper_id) FROM paper |
Write SQL query to solve given problem: What is the most cited word? How many papers was that word cited in?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | SELECT word_cited_id, COUNT(paper_id) FROM content GROUP BY word_cited_id ORDER BY COUNT(word_cited_id) DESC LIMIT 1 |
Write SQL query to solve given problem: What is the total number of word cited under that class labelled 'AI'?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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' |
Write SQL query to solve given problem: For all words cited in paper ID 315017, state the other paper ID and class label which also cited those words.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | SELECT T1.class_label, T2.word_cited_id FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id WHERE T1.paper_id = 315017 |
Write SQL query to solve given problem: Among all the DB class type citation, which word is the most frequently cited?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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 |
Write SQL query to solve given problem: Calculate the percentage of words used in Agents class label.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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 |
Write SQL query to solve given problem: Which paper ID cited the most word? In which class label does it belongs to?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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 |
Write SQL query to solve given problem: List all the paper ID and its class type that cited the word 'word1002'.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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' |
Write SQL query to solve given problem: List all words cited in the AI class label.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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' |
Write SQL query to solve given problem: What is the class label of paper ID 'chakrabarti01integrating'. How many words were cited by this paper ID?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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 |
Write SQL query to solve given problem: List all paper ID and its class type with more than 20 cited words.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | SELECT DISTINCT T1.paper_id, T1.class_label FROM paper AS T1 INNER JOIN content AS T2 ON T1.paper_id = T2.paper_id GROUP BY T2.paper_id, T1.class_label HAVING COUNT(T2.word_cited_id) > 20 |
Write SQL query to solve given problem: List the words that are cited in both AI and IR class label.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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' |
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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 |
Write SQL query to solve given problem: On average, how many papers are under the ML class?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | SELECT CAST(COUNT(CASE WHEN class_label = 'ML' THEN paper_id ELSE NULL END) AS REAL) / COUNT(paper_id) FROM paper |
Write SQL query to solve given problem: Find the words cited in papers that are cited by sima01computational?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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' |
Write SQL query to solve given problem: How many papers were cited by schmidt99advanced cited word3555?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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' |
Write SQL query to solve given problem: Under what classification do the papers that cited word1163 belong?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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' |
Write SQL query to solve given problem: Among the papers under DB classification, which paper has the highest number of words cited?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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 |
Write SQL query to solve given problem: In the papers classified as ML, how many cited butz01algorithmic?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | citeseer | 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' |
Write SQL query to solve given problem: Which crew member of the simpson 20s is the oldest?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | SELECT name FROM Person WHERE birthdate IS NOT NULL ORDER BY birthdate ASC LIMIT 1; |
Write SQL query to solve given problem: What's the nickname for Dan Castellaneta?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | SELECT nickname FROM Person WHERE name = 'Dan Castellaneta'; |
Write SQL query to solve given problem: Among the crew members of the simpson 20s born in the New York city, how many of them were born after the year 1970?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | SELECT COUNT(name) FROM Person WHERE birth_region = 'New York' AND SUBSTR(birthdate, 1, 4) > '1970'; |
Write SQL query to solve given problem: In which country was the winner of the Outstanding Voice-Over Performance award of 2009 born?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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'; |
Write SQL query to solve given problem: Please list the names of all the awards won by the crew member whose nickname is Doofus.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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'; |
Write SQL query to solve given problem: 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?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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; |
Write SQL query to solve given problem: Which character won the Outstanding Voice-Over Performance award in 2009?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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'; |
Write SQL query to solve given problem: Please list all the keywords of the episode Lost Verizon.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Lost Verizon'; |
Write SQL query to solve given problem: How many keywords does the episode that was aired on 2008/10/19 have?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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'; |
Write SQL query to solve given problem: What's the rating of the episode in which Dan Castellaneta won the Outstanding Voice-Over Performance award in 2009?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | SELECT T2.rating FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award = 'Outstanding Voice-Over Performance' AND SUBSTR(T1.year, 1, 4) = '2009' AND T1.person = 'Dan Castellaneta'; |
Write SQL query to solve given problem: How many 7-star votes in star score did the episode Lost Verizon have?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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; |
Write SQL query to solve given problem: How many stars did most of the voters give in star score for the episode Lost Verizon?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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; |
Write SQL query to solve given problem: Please list the titles of the episodes that have over 200 voters voting a 10 in star score.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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; |
Write SQL query to solve given problem: How many episodes aired in the year 2009 have over 15% of voters giving 10 stars in star score?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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; |
Write SQL query to solve given problem: What's the title of the episode that got the most 7-star votes in star score?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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; |
Write SQL query to solve given problem: How many stars on average does the episode Lost Verizon have?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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'; |
Write SQL query to solve given problem: What is the percentage of Primetime Emmy nominated episodes with a rating over 7 to all the episodes that have a rating over 7?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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'; |
Write SQL query to solve given problem: Name the title of the episode where Pamela Hayden voiced the character 'Ruthie.'. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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'; |
Write SQL query to solve given problem: 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.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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'; |
Write SQL query to solve given problem: Write down the title and summary of the episode with the keyword 'eviction.'. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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'; |
Write SQL query to solve given problem: What is the average number of stars received by the episode titled 'Wedding for Disaster.'. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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'; |
Write SQL query to solve given problem: Write the title and all the keywords of the episode that was aired on 3/22/2009.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | 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'; |
Write SQL query to solve given problem: What is the birth name of the person who voiced 'Helen Lovejoy?'. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | SELECT DISTINCT T1.birth_name FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T2.role = 'Helen Lovejoy'; |
Write SQL query to solve given problem: What is the percentage ratio between uncredited and credited roles on the episode that won the 2017 Jupiter Award for Best International TV Series? Please include the title of the episode and the names of the persons who were uncredited alongside their role in that episode.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | SELECT CAST(SUM(CASE WHEN T2.credited = 'false' THEN 1 END) AS REAL) * 100 / SUM(CASE WHEN T2.credited = 'true' THEN 1 END), T3.title, T2.person FROM Award AS T1 INNER JOIN Credit AS T2 ON T2.episode_id = T1.episode_id INNER JOIN Episode AS T3 ON T1.episode_id = T3.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2017' AND T1.award_category = 'Jupiter Award' AND T1.award = 'Best International TV Series' AND T1.result = 'Winner'; |
Write SQL query to solve given problem: How many episodes have more than 1000 votes?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | SELECT COUNT(episode_id) FROM Episode WHERE votes > 1000; |
Write SQL query to solve given problem: How many persons were born in New York, USA?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | SELECT COUNT(name) FROM Person WHERE birth_place = 'New York City' AND birth_country = 'USA'; |
Write SQL query to solve given problem: List the name of all awards along with the award category, nominated by Marc Wilmore.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | SELECT award_id, award_category FROM Award WHERE person = 'Marc Wilmore'; |
Write SQL query to solve given problem: How many crew have their own nickname? List their full name along with the nickname.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | SELECT COUNT(name) FROM Person WHERE nickname IS NOT NULL; |
Write SQL query to solve given problem: Find the average height for each person.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | simpson_episodes | SELECT AVG(height_meters) FROM Person; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.