problem
stringlengths 121
422
| db_id
stringclasses 69
values | solution
stringlengths 23
804
|
---|---|---|
Write SQL query to solve given problem: Please list the names of the films released in 2003 among the films scored by user 2941 .. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_release_year = 2003 AND T1.user_id = 2941 |
Write SQL query to solve given problem: How many users were not trialists when they rated the movie "Patti Smith: Dream of Life"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(T1.user_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'Patti Smith: Dream of Life' AND T1.user_trialist = 0 |
Write SQL query to solve given problem: Which movie has the highest average score in Mubi?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id GROUP BY T2.movie_title ORDER BY SUM(T1.rating_score) / COUNT(T1.rating_id) DESC LIMIT 1 |
Write SQL query to solve given problem: Please list the names of the top three movies in the number comments related to the critic made by the user rating the movie.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id ORDER BY T1.critic_comments DESC LIMIT 3 |
Write SQL query to solve given problem: What was the title of the first list created by a user 85981819? And please provide the user_avatar_image_url.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.list_title, T1.user_avatar_image_url FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T1.user_id = 85981819 ORDER BY T2.list_creation_timestamp_utc LIMIT 1 |
Write SQL query to solve given problem: Please list the names of the movies that have been rated the most times in 2020.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_timestamp_utc LIKE '2020%' GROUP BY T2.movie_title ORDER BY COUNT(T2.movie_title) DESC LIMIT 1 |
Write SQL query to solve given problem: What is the average score for the movie Versailles Rive-Gauche?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT AVG(T1.rating_score) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title LIKE 'Versailles Rive-Gauche' |
Write SQL query to solve given problem: Which film rated by user 59988436 that received 21 comments?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.user_id = 59988436 AND T1.critic_comments = 21 |
Write SQL query to solve given problem: Please list the names of the movies that received more than 20 likes?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.critic_likes > 20 |
Write SQL query to solve given problem: What is the average score of the movie "The Fall of Berlin" in 2019?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT SUM(T1.rating_score) / COUNT(T1.rating_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_timestamp_utc LIKE '2019%' AND T2.movie_title LIKE 'The Fall of Berlin' |
Write SQL query to solve given problem: What percentage of users rated the movie "Patti Smith: Dream of Life" by more than 3?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT CAST(SUM(CASE WHEN T1.rating_score > 3 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.rating_score) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title LIKE 'Patti Smith: Dream of Life' |
Write SQL query to solve given problem: Which of the film directed by director Abbas Kiarostami has the highest average score?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.director_name = 'Abbas Kiarostami' GROUP BY T2.movie_title ORDER BY SUM(T1.rating_score) / COUNT(T1.rating_id) DESC LIMIT 1 |
Write SQL query to solve given problem: Which year had the most released films?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT movie_release_year FROM movies GROUP BY movie_release_year ORDER BY COUNT(movie_id) DESC LIMIT 1 |
Write SQL query to solve given problem: Who is the director that made the most movies? Give the director's id.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT director_id FROM movies GROUP BY director_id ORDER BY COUNT(movie_id) DESC LIMIT 1 |
Write SQL query to solve given problem: How many movies did the director of the highest movie popularity make?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(movie_id) FROM movies WHERE director_id = ( SELECT director_id FROM movies ORDER BY movie_popularity DESC LIMIT 1 ) |
Write SQL query to solve given problem: What's the number of the paying subscribers when rating a movie after the year 2014?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(user_subscriber) FROM ratings_users WHERE user_has_payment_method = 1 AND rating_date_utc > '2014%' |
Write SQL query to solve given problem: Who was the earliest user created a list but didn't get any followers? Give the user ID.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT user_id FROM lists_users WHERE user_subscriber = 0 ORDER BY list_creation_date_utc LIMIT 1 |
Write SQL query to solve given problem: Give the number of followers for the user who posted the most lists.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT SUM(T1.list_followers) FROM lists AS T1 INNER JOIN lists_users AS T2 ON T1.list_id = T2.list_id GROUP BY T1.user_id ORDER BY COUNT(T1.list_id) DESC LIMIT 1 |
Write SQL query to solve given problem: How many followers did the user who posted the list "Non-American Films about World War II" have?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT SUM(T2.list_followers) FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_title LIKE 'Non-American Films about World War II' |
Write SQL query to solve given problem: What's the number of users gave the movie "Downfall" a rating of "4"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(T1.user_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'Downfall' AND T1.rating_score = 4 |
Write SQL query to solve given problem: Give the name of the movie that got the most "5" ratings.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_score = 5 |
Write SQL query to solve given problem: Which movie got the most critic comments? Give the name of the movie.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id GROUP BY T2.movie_title ORDER BY COUNT(T1.critic_comments) DESC LIMIT 1 |
Write SQL query to solve given problem: Show the avatar of the user who gave the rating at 2019/10/17 1:36:36.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.user_avatar_image_url FROM ratings AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T2.user_id WHERE T1.rating_timestamp_utc LIKE '2019-10-17 01:36:36' |
Write SQL query to solve given problem: Show the portrait picture of the user who created the list "Vladimir Vladimirovich Nabokov".. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T1.user_avatar_image_url FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_title LIKE 'Vladimir Vladimirovich Nabokov' |
Write SQL query to solve given problem: For the user who post the list that contained the most number of the movies, is he/she a paying subscriber when creating that list?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T1.user_has_payment_method FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_movie_number = ( SELECT MAX(list_movie_number) FROM lists ) |
Write SQL query to solve given problem: Show the head portrait of the user who gave the most "5" ratings.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.user_avatar_image_url FROM ratings AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T2.user_id WHERE T1.rating_score = 5 |
Write SQL query to solve given problem: How many critics were given to the movie that got the most movie popularity number.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(T1.critic) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_popularity = ( SELECT MAX(movie_popularity) FROM movies ) |
Write SQL query to solve given problem: Who gave a "4" rating to the movie "Freaks" at 2013/5/4 6:33:32? Give his/her user id.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T1.user_id FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE rating_score = 4 AND rating_timestamp_utc LIKE '2013-05-04 06:33:32' AND T2.movie_title LIKE 'Freaks' |
Write SQL query to solve given problem: Give the url of movie which was rated 5 on 2013/5/3 5:11:17.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_url FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE rating_score = 5 AND rating_timestamp_utc LIKE '2013-05-03 05:11:17' |
Write SQL query to solve given problem: For the 1998 movie which got the highest popularity, how many "4" rating did the movie get?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(T2.movie_title) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_score = 4 AND T2.movie_release_year = 1998 ORDER BY T2.movie_popularity DESC LIMIT 1 |
Write SQL query to solve given problem: From all the movies that got more than 13000 popularity number, which one had the least ratings.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_popularity > 13000 ORDER BY T1.rating_score LIMIT 1 |
Write SQL query to solve given problem: How many paying subscribers gave a rating to the movie "One Flew Over the Cuckoo's Nest"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(T1.user_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id INNER JOIN ratings_users AS T3 ON T1.user_id = T3.user_id WHERE T2.movie_title = 'One Flew Over the Cuckoo''s Nest' AND T3.user_has_payment_method = 1 |
Write SQL query to solve given problem: For the lists that got more than 3000 followers, how many did the users who created those lists are paying subscribers?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(T1.user_id) FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_followers > 3000 AND T1.user_has_payment_method = 1 |
Write SQL query to solve given problem: Which 1988 movie got the most ratings?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_release_year = 1988 ORDER BY T1.rating_score DESC LIMIT 1 |
Write SQL query to solve given problem: For all the movies that were released in 1995, how many lower than 3 ratings did the most popularity movie had?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(T1.rating_score) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.rating_score < 3 AND T2.movie_release_year = 1995 AND T2.movie_popularity = ( SELECT MAX(movie_popularity) FROM movies WHERE movie_release_year = 1995 ) |
Write SQL query to solve given problem: What is the percentage of users gave "5" to the movie "Go Go Tales"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT CAST(SUM(CASE WHEN T1.rating_score = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.user_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'Go Go Tales' |
Write SQL query to solve given problem: Give the percentage of subscribers who rated who rated the movie "G.I. Jane".. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT CAST(SUM(CASE WHEN T3.user_subscriber = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id INNER JOIN lists_users AS T3 ON T1.user_id = T3.user_id WHERE T2.movie_title = 'G.I. Jane' |
Write SQL query to solve given problem: For all the users who gave "A Shot in the Dark" a rating, how many percent of them is a paying subscriber?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT CAST(SUM(CASE WHEN T1.user_has_payment_method = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id INNER JOIN lists_users AS T3 ON T1.user_id = T3.user_id WHERE T2.movie_title = 'A Shot in the Dark' |
Write SQL query to solve given problem: Name all the list titles created by user 4208563.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT list_title FROM lists WHERE user_id LIKE 4208563 |
Write SQL query to solve given problem: Among the lists created in 2016, which is the list that was updated most recently.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT list_title FROM lists WHERE strftime('%Y', list_update_timestamp_utc) = '2016' ORDER BY list_update_timestamp_utc DESC LIMIT 1 |
Write SQL query to solve given problem: What is the percentage of list created by user who was a subscriber when he created the list?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT CAST(SUM(CASE WHEN user_subscriber = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(list_id) FROM lists_users |
Write SQL query to solve given problem: Name all lists created by a user who was a subcriber when created the list.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT DISTINCT T2.list_id FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T1.user_subscriber = 1 |
Write SQL query to solve given problem: Provide list titles created by user who are eligible for trial when he created the list.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT DISTINCT T2.list_title FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T1.user_eligible_for_trial = 1 |
Write SQL query to solve given problem: Among the lists with at least one follower, how many were created by user who was subscriber when created the list?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(T1.list_id) FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_followers >= 1 AND T1.user_subscriber = 1 |
Write SQL query to solve given problem: For all list titles with at least 200 movies in the list, what is their average number of followers?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT AVG(list_followers) FROM lists WHERE list_movie_number > 200 |
Write SQL query to solve given problem: List all the titles created by user who was a subsriber when he created the list and have less than 50 movies in the list.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT DISTINCT T2.list_title FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_movie_number < 50 AND T1.user_subscriber = 1 |
Write SQL query to solve given problem: Which title list has not been updated for the longest period of time? State how long it has not been updated?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT list_title , datetime(CURRENT_TIMESTAMP, 'localtime') - datetime(list_update_timestamp_utc) FROM lists ORDER BY list_update_timestamp_utc LIMIT 1 |
Write SQL query to solve given problem: Who is the user who created the list titled 'Sound and Vision'? Was he a subcriber when he created the list?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T1.user_id, T1.user_subscriber FROM lists_users AS T1 INNER JOIN lists AS T2 ON T1.list_id = T2.list_id WHERE T2.list_title LIKE 'Sound and Vision' |
Write SQL query to solve given problem: For the list with more than 200 followers, state the title and how long the list has been created?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT list_title , 365 * (strftime('%Y', 'now') - strftime('%Y', list_creation_timestamp_utc)) + 30 * (strftime('%m', 'now') - strftime('%m', list_creation_timestamp_utc)) + strftime('%d', 'now') - strftime('%d', list_creation_timestamp_utc) FROM lists WHERE list_followers > 200 |
Write SQL query to solve given problem: Among all movies in the list, calculate the percentage of movies that were never been rated?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT CAST(SUM(CASE WHEN T2.movie_id IS NULL THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.movie_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id |
Write SQL query to solve given problem: List all movies rated by user 39115684. State the title, rating date and rating score.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title, T1.rating_timestamp_utc, T1.rating_score FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.user_id = 39115684 |
Write SQL query to solve given problem: Between 1970 to 1980, how many movies with a popularity of more than 11,000 were released?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(movie_id) FROM movies WHERE movie_release_year BETWEEN '1970' AND '1980' AND movie_popularity > 11000 |
Write SQL query to solve given problem: How many movies directed by Felipe Cazals was realeased on 1976?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(movie_id) FROM movies WHERE movie_release_year = 1976 AND director_name LIKE 'Felipe Cazals' |
Write SQL query to solve given problem: What is the URL to the movie director page on Mubi of the movie titled "Red Blooded American Girl". Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT director_url FROM movies WHERE movie_title LIKE 'Red Blooded American Girl' |
Write SQL query to solve given problem: What is the name of the list that was updated most recently?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT list_title FROM lists WHERE list_update_timestamp_utc = ( SELECT list_update_timestamp_utc FROM lists ORDER BY list_update_timestamp_utc DESC LIMIT 1 ) |
Write SQL query to solve given problem: Who created the list that has 142 comments? Indicate the user id of the user, if there are multiple lists with 142 comments, list the user id of the person who created the list. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT user_id FROM lists WHERE list_comments = 142 |
Write SQL query to solve given problem: What is Jeannot Szwarc's most popular movie and what is its average rating score?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title, AVG(T1.rating_score) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.director_name = 'Jeannot Szwarc' ORDER BY T2.movie_popularity DESC LIMIT 1 |
Write SQL query to solve given problem: Who is the director that directed the highest number of movies in the 70s? If there are multiple directors with the same amount of movies, list all of their names and indicate the highest rating score that those movies got from the users.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.director_name, T1.rating_score FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_release_year BETWEEN 1970 AND 1979 GROUP BY T2.director_id ORDER BY COUNT(T2.movie_id) DESC LIMIT 1 |
Write SQL query to solve given problem: Between 1/1/2010 to 12/31/2020, how many users, who were a trialist when they created the list, gave the movie "The Secret Life of Words" a rating score of 3?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(T1.user_id) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T2.movie_title = 'The Secret Life of Words' AND T1.rating_score = 3 AND T1.user_trialist = 0 AND T1.rating_timestamp_utc BETWEEN '2010%' AND '2020%' |
Write SQL query to solve given problem: What is the name of the movie whose critic received the highest amount of likes? Indicate the URL to the rating on Mubi.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title, T1.rating_url FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id ORDER BY T1.critic_likes DESC LIMIT 1 |
Write SQL query to solve given problem: What are the top 5 most popular movies of the 21st century? Indicate how many users gave it a rating score of 5.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT DISTINCT T2.movie_id, SUM(T1.rating_score = 5) FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id ORDER BY T2.movie_popularity DESC LIMIT 5 |
Write SQL query to solve given problem: What is the average number of followers of the lists created by the user who rated the movie "Pavee Lackeen: The Traveller Girl" on 3/27/2011 at 2:06:34 AM?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT CAST(SUM(T4.list_followers) AS REAL) / COUNT(T2.list_id) FROM ratings AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T2.user_id INNER JOIN movies AS T3 ON T1.movie_id = T3.movie_id INNER JOIN lists AS T4 ON T2.list_id = T4.list_id WHERE T3.movie_title LIKE 'Pavee Lackeen: The Traveller Girl' AND T1.rating_timestamp_utc LIKE '2011-03-27 02:06:34' |
Write SQL query to solve given problem: Between 1/1/2017 to 12/31/2017, how many users who were eligible for trial when they rated the movie "Patti Smith: Dream of Life"and what is the image URL to the movie on Mubi?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT COUNT(T1.user_id), T2.movie_image_url FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE datetime(T1.rating_timestamp_utc) BETWEEN '2017-01-01 00:00:00' AND '2017-12-31 00:00:00' |
Write SQL query to solve given problem: What is the average number of number of movies added to the lists of user 8516503? Indicate how many movies did he/she give a rating score of 5.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT AVG(T3.list_movie_number) , SUM(CASE WHEN T1.rating_score = 5 THEN 1 ELSE 0 END) FROM ratings AS T1 INNER JOIN lists_users AS T2 ON T1.user_id = T2.user_id INNER JOIN lists AS T3 ON T2.user_id = T3.user_id WHERE T1.user_id = 8516503 |
Write SQL query to solve given problem: Who is the director of the most popular movie of all time and when was it released? Indicate the average rating score of the users who were on a trialist when they rated the movie.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T1.director_name, T1.movie_release_year , SUM(T2.rating_score) / COUNT(T2.user_id) FROM movies AS T1 INNER JOIN ratings AS T2 ON T1.movie_id = T2.movie_id WHERE T2.user_trialist = 1 ORDER BY T1.movie_popularity DESC LIMIT 1 |
Write SQL query to solve given problem: What is the name of the movie that was rated recently by user 57756708?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_title FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id WHERE T1.user_id = 57756708 ORDER BY T1.rating_timestamp_utc DESC LIMIT 1 |
Write SQL query to solve given problem: What are the top 10 oldest movies and what are the average rating score for each movie? Indicate the name of the director and when the movies were released.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_platform | SELECT T2.movie_id, AVG(T1.rating_score), T2.director_name, T2.movie_release_year FROM ratings AS T1 INNER JOIN movies AS T2 ON T1.movie_id = T2.movie_id ORDER BY T1.rating_timestamp_utc ASC LIMIT 10 |
Write SQL query to solve given problem: Which date has the most ordered quantity? What is the total order quantity on that day?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT ord_date, SUM(qty) FROM sales GROUP BY ord_date ORDER BY SUM(qty) DESC LIMIT 1 |
Write SQL query to solve given problem: What is the title with the most ordered quantity in year 1992?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T2.title FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id WHERE STRFTIME('%Y', T1.ord_date) = '1992' ORDER BY T1.qty DESC LIMIT 1 |
Write SQL query to solve given problem: List the title, price and publication date for all sales with 'ON invoice' payment terms.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T2.title, T2.price, T2.pubdate FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id WHERE T1.payterms = 'ON invoice' |
Write SQL query to solve given problem: What is the title that have at least 10% royalty without minimum range amount.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.title FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange = 0 AND T2.royalty >= 10 |
Write SQL query to solve given problem: State the title and royalty percentage for title ID BU2075 between 10000 to 50000 range.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.title, T2.royalty FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange > 10000 AND T2.hirange < 50000 AND T1.title_ID = 'BU2075' |
Write SQL query to solve given problem: Among the titles with royalty percentage, which title has the greatest royalty percentage. State it's minimum range to enjoy this royalty percentage.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.title, T2.lorange FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id ORDER BY T2.royalty DESC LIMIT 1 |
Write SQL query to solve given problem: Provide a list of titles together with its publisher name for all publishers located in the USA.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.title, T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.country = 'USA' |
Write SQL query to solve given problem: State the royalty percentage for the most year to date sale title within the 20000 range.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT MAX(T1.ytd_sales) FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id WHERE T2.lorange > 20000 AND T2.hirange < 20000 |
Write SQL query to solve given problem: List all titles published in year 1991. Also provide notes details of the title and the publisher's name.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.title, T1.notes, T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE STRFTIME('%Y', T1.pubdate) = '1991' |
Write SQL query to solve given problem: List all titles with sales of quantity more than 20 and store located in the CA state.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.title, T2.qty FROM titles AS T1 INNER JOIN sales AS T2 ON T1.title_id = T2.title_id INNER JOIN stores AS T3 ON T2.stor_id = T3.stor_id WHERE T2.qty > 20 AND T3.state = 'CA' |
Write SQL query to solve given problem: Name the store with the highest quantity in sales? What is the least quantity title from the store's sale?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T3.stor_id, T2.title FROM sales AS T1 INNER JOIN titles AS T2 ON T1.title_id = T2.title_id INNER JOIN stores AS T3 ON T3.stor_id = T1.stor_id WHERE T3.stor_id = ( SELECT stor_id FROM sales GROUP BY stor_id ORDER BY SUM(qty) DESC LIMIT 1 ) GROUP BY T3.stor_id, T2.title ORDER BY SUM(T1.qty) ASC LIMIT 1 |
Write SQL query to solve given problem: Name the title and publisher for title ID BU 2075. Provide all the royalty percentage for all ranges.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.title, T3.pub_name, T2.lorange, T2.hirange, T2.royalty FROM titles AS T1 INNER JOIN roysched AS T2 ON T1.title_id = T2.title_id INNER JOIN publishers AS T3 ON T1.pub_id = T3.pub_id WHERE T1.title_id = 'BU2075' |
Write SQL query to solve given problem: Name the store with ID 7066 and calculate the percentage of the the quantity ordered that were on 'Net 30' payment terms.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T2.stor_name , CAST(SUM(CASE WHEN payterms = 'Net 30' THEN qty ELSE 0 END) AS REAL) * 100 / SUM(qty) FROM sales AS T1 INNER JOIN stores AS T2 ON T1.stor_id = T2.stor_id WHERE T1.stor_id = '7066' GROUP BY T2.stor_name |
Write SQL query to solve given problem: State the publisher name for publisher ID 877? Calculate its average year to date sales.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T2.pub_name, AVG(T1.ytd_sales) FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T1.pub_id = '0877' GROUP BY T2.pub_name |
Write SQL query to solve given problem: Name all employees who were hired before year 1990.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT fname, lname FROM employee WHERE STRFTIME('%Y', hire_date) < '1990' |
Write SQL query to solve given problem: Which employee has the lowest job level. State the first name, last name and when he /she was hired.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT fname, lname, hire_date FROM employee ORDER BY job_lvl LIMIT 1 |
Write SQL query to solve given problem: In which year has the most hired employees?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT STRFTIME('%Y', hire_date) FROM employee GROUP BY STRFTIME('%Y', hire_date) ORDER BY COUNT(emp_id) DESC LIMIT 1 |
Write SQL query to solve given problem: List all employees who are at the maximum level in their job designation.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.fname, T1.lname FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.job_lvl = T2.max_lvl |
Write SQL query to solve given problem: Name the Chief Executive Officer and when he/she was hired.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.fname, T1.lname, T1.hire_date FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T2.job_desc = 'Chief Financial Officier' |
Write SQL query to solve given problem: Who are the employees working for publisher not located in USA? State the employee's name and publisher name.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.fname, T1.lname, T2.pub_name FROM employee AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.country != 'USA' |
Write SQL query to solve given problem: List all employees working for publisher 'GGG&G'. State their name and job description.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.fname, T1.lname, T3.job_desc FROM employee AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id INNER JOIN jobs AS T3 ON T1.job_id = T3.job_id WHERE T2.pub_name = 'GGG&G' |
Write SQL query to solve given problem: For each publisher, state the type of titles they published order by the publisher name.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT DISTINCT T2.pub_name, T1.type FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id ORDER BY T2.pub_name |
Write SQL query to solve given problem: Name the publisher which has the most titles published in 1991.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T2.pub_name FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE STRFTIME('%Y', T1.pubdate) = '1991' GROUP BY T1.pub_id, T2.pub_name ORDER BY COUNT(T1.title_id) DESC LIMIT 1 |
Write SQL query to solve given problem: Name the title with the highest price published by 'Binnet & Hardley'.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.title FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.pub_name = 'Binnet & Hardley' ORDER BY T1.price DESC LIMIT 1 |
Write SQL query to solve given problem: Among all employees, who have job level greater than 200. State the employee name and job description.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.fname, T1.lname, T2.job_desc FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id WHERE T1.job_lvl > 200 |
Write SQL query to solve given problem: Name all the authors for all business titles.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T3.au_fname, T3.au_lname FROM titles AS T1 INNER JOIN titleauthor AS T2 ON T1.title_id = T2.title_id INNER JOIN authors AS T3 ON T2.au_id = T3.au_id WHERE T1.type = 'business' |
Write SQL query to solve given problem: List all the titles and year to date sales by author who are not on contract.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.title_id, T1.ytd_sales FROM titles AS T1 INNER JOIN titleauthor AS T2 ON T1.title_id = T2.title_id INNER JOIN authors AS T3 ON T2.au_id = T3.au_id WHERE T3.contract = 0 |
Write SQL query to solve given problem: For all authors from CA who are not on contract, which title of his/hers has the most year to date sales.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.title FROM titles AS T1 INNER JOIN titleauthor AS T2 ON T1.title_id = T2.title_id INNER JOIN authors AS T3 ON T2.au_id = T3.au_id WHERE T3.contract = 0 AND T3.state = 'CA' ORDER BY T1.ytd_sales DESC LIMIT 1 |
Write SQL query to solve given problem: Name all the authors for 'Sushi, Anyone?'.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T3.au_fname, T3.au_lname FROM titles AS T1 INNER JOIN titleauthor AS T2 ON T1.title_id = T2.title_id INNER JOIN authors AS T3 ON T2.au_id = T3.au_id WHERE T1.title = 'Sushi, Anyone?' |
Write SQL query to solve given problem: Calculate the percentage of the employees who are Editor or Designer?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT CAST(SUM(CASE WHEN T2.job_desc IN ('Editor', 'Designer') THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.job_id) FROM employee AS T1 INNER JOIN jobs AS T2 ON T1.job_id = T2.job_id |
Write SQL query to solve given problem: List all titles which have year to date sales higher than the average order by pubisher name.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.title FROM titles AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T1.ytd_sales > ( SELECT AVG(ytd_sales) FROM titles ) |
Write SQL query to solve given problem: How many publishers are in the USA?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT COUNT(pub_id) FROM publishers WHERE country = 'USA' |
Write SQL query to solve given problem: What is the publisher's information of New Moon Books?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | book_publishing_company | SELECT T1.pr_info FROM pub_info AS T1 INNER JOIN publishers AS T2 ON T1.pub_id = T2.pub_id WHERE T2.pub_name = 'New Moon Books' |
Subsets and Splits