Chinastark/bird_dataset huggingface dataset:
Database: movielens
Note: Male users refers to u_gender = 'M';
Question: For the male users no older than 18, how many times have they given the highest rating?
SQL: SELECT count(u2base.movieid) FROM u2base INNER JOIN users ON u2base.userid = users.userid WHERE u2base.rating = 5 AND users.age < 18 AND users.u_gender = 'M'
Database: movielens
Note: Female users refers to u_gender = 'F';
Question: Please list the ID of the movie that has been mostly rated by female users.
SQL: SELECT u2base.movieid FROM u2base INNER JOIN users ON u2base.userid = users.userid WHERE users.u_gender = 'F' GROUP BY u2base.movieid ORDER BY count(users.userid) DESC LIMIT 1
Database: movielens
Note: UK is a country;
Question: Among divergent movies that got the highest rating, how many of them are from the UK?
SQL: SELECT count(DISTINCT u2base.movieid) FROM u2base INNER JOIN movies ON u2base.movieid = movies.movieid WHERE movies.country = 'UK' AND u2base.rating = 5
Database: movielens
Note: year contains relative value, higer year value refers to newer date; year = 4 refers to newest date, year = 1 refer to oldest date; Lowest rating = 1;
Question: Please list different IDs of movies that are the newest and have gotten the lowest rating.
SQL: SELECT DISTINCT u2base.movieid FROM u2base INNER JOIN movies ON u2base.movieid = movies.movieid WHERE movies.year = 4 AND u2base.rating = 1
Database: movielens
Note: year contains relative value, higer year value refers to newer date; year = 4 refers to newest date, year = 1 refer to oldest date; Lowest rating = 1；isenglish = 'T' means English movie;
Question: For the movies in English that are the oldest, how many of them have the lowest rating?
SQL: SELECT count(DISTINCT movies.movieid) FROM movies INNER JOIN u2base ON movies.movieid = u2base.movieid WHERE movies.year = 1 AND u2base.rating = 1 AND movies.isenglish = 'T'
Database: movielens
Note: France is a country; Female users mean that u_gender = 'F';
Question: How many different female users have rated movies from France?
SQL: SELECT count(DISTINCT u2base.userid) FROM users INNER JOIN u2base ON users.userid = u2base.userid INNER JOIN movies ON u2base.movieid = movies.movieid WHERE users.u_gender = 'F' AND movies.country = 'France'
Database: movielens
Note: direct well means the quality of directing is good, which means d_quality = 4.;
Question: For different directors who direct well, how many of them have directed an action film?
SQL: SELECT count(DISTINCT movies2directors.directorid) FROM movies2directors INNER JOIN directors ON movies2directors.directorid = directors.directorid WHERE movies2directors.genre = 'Action' AND directors.d_quality = 4
Database: movielens
Question: Please list the genre of the movies that are directed by the directors with the highest level of average revenue.
SQL: SELECT movies2directors.genre FROM directors INNER JOIN movies2directors ON directors.directorid = movies2directors.directorid WHERE directors.avg_revenue = 4
Database: movielens
Note: Male actors mean that a_gender = 'M'; isenglish = 'T' means movies in English;
Question: How many distinct movies in English stars a male actor who acts the best?
SQL: SELECT count(DISTINCT actors.actorid) FROM actors INNER JOIN movies2actors ON actors.actorid = movies2actors.actorid INNER JOIN movies ON movies2actors.movieid = movies.movieid WHERE movies.isenglish = 'T' AND actors.a_gender = 'M' AND actors.a_quality = 5
Database: movielens
Note: a_quality = 5 refers to act the best, a_quality = 0 refers to act the worst;
Question: Please list the country of the movie that stars an actress who acts the worse.
SQL: SELECT movies.country FROM actors INNER JOIN movies2actors ON actors.actorid = movies2actors.actorid INNER JOIN movies ON movies2actors.movieid = movies.movieid WHERE actors.a_gender = 'F' AND actors.a_quality = 0
Database: movielens
Note: USA is a country;
Question: What is the highest average rating for action movies made in the USA?
SQL: SELECT avg(u2base.rating) FROM movies INNER JOIN u2base ON movies.movieid = u2base.movieid INNER JOIN movies2directors ON movies.movieid = movies2directors.movieid WHERE movies.country = 'USA' AND movies2directors.genre = 'Action' GROUP BY movies.movieid ORDER BY avg(u2base.rating) DESC LIMIT 1
Database: movielens
Note: d_quality = 5 refers to direct the best, d_quality = 0 refers to direct the worst;
Question: Among the films directed by directors who direct the best, how many of them have an average rating of over 3.5?
SQL: SELECT count(*) FROM ( SELECT DISTINCT movies2directors.movieid FROM directors INNER JOIN movies2directors ON directors.directorid = movies2directors.directorid INNER JOIN u2base ON movies2directors.movieid = u2base.movieid WHERE directors.d_quality = 5 GROUP BY movies2directors.movieid HAVING avg(u2base.rating) > 3.5 ) AS directors
Database: movielens
Question: Which adventure movie has the highest average rating?
SQL: SELECT movies2directors.movieid FROM movies2directors INNER JOIN u2base ON movies2directors.movieid = u2base.movieid WHERE movies2directors.genre = 'Adventure' GROUP BY movies2directors.movieid ORDER BY avg(u2base.rating) DESC LIMIT 1
Database: movielens
Note: Female users mean that u_gender = 'F';
Question: How many of the users who rate the movie with the id '2462959' are female?
SQL: SELECT count(users.userid) FROM users INNER JOIN u2base ON users.userid = u2base.userid WHERE u2base.userid = 2462959 AND users.u_gender = 'F'
Database: movielens
Question: What is the most distinct rated movie with a running time of 0?
SQL: SELECT DISTINCT movies.movieid FROM movies INNER JOIN u2base ON movies.movieid = u2base.movieid WHERE movies.runningtime = 0 AND u2base.rating = ( SELECT max(rating) FROM u2base )
Database: movielens
Question: List the ids and ratings of each actors played in the movie with the id 1722327?
SQL: SELECT actors.actorid, actors.a_quality FROM actors INNER JOIN movies2actors ON actors.actorid = movies2actors.actorid WHERE movies2actors.movieid = 1722327
Database: movielens
Note: d_quality = 5 refers to direct the best;
Question: Which directors with the best quality directed the most films?
SQL: SELECT directors.directorid FROM directors INNER JOIN movies2directors ON directors.directorid = movies2directors.directorid WHERE directors.d_quality = 5 GROUP BY directors.directorid ORDER BY count(movies2directors.movieid) DESC LIMIT 1
Database: movielens
Question: How many drama movie with the rating of 3?
SQL: SELECT count(DISTINCT movies2directors.movieid) FROM u2base INNER JOIN movies2directors ON u2base.movieid = movies2directors.movieid WHERE movies2directors.genre = 'drama' AND u2base.rating = 3
Database: movielens
Question: How many of the movies rated 5 are rated by a user between the ages of 25 and 35?
SQL: SELECT count(u2base.movieid) FROM u2base INNER JOIN users ON u2base.userid = users.userid WHERE u2base.rating = 5 AND users.age BETWEEN 25 AND 35
Database: movielens
Question: Please list all horror films that have a rating of 1.
SQL: SELECT u2base.movieid FROM u2base INNER JOIN movies2directors ON u2base.movieid = movies2directors.movieid WHERE u2base.rating = 1 AND movies2directors.genre = 'Horror'
Database: movielens
Note: France is a country;
Question: List the IDs of all the directors who worked on French films.
SQL: SELECT movies2directors.directorid FROM movies INNER JOIN movies2directors ON movies.movieid = movies2directors.movieid WHERE movies.country = 'France'
Database: movielens
Question: List all of the user ids and ages who rated movies with the id 1695219?
SQL: SELECT users.userid, users.age FROM u2base INNER JOIN users ON u2base.userid = users.userid WHERE u2base.movieid = 1695219
Database: movielens
Note: isenglish = 'F' means non-English;
Question: Which genre contains the greatest number of non-English films?
SQL: SELECT movies2directors.genre FROM movies INNER JOIN movies2directors ON movies.movieid = movies2directors.movieid WHERE movies.isenglish = 'F' GROUP BY movies2directors.genre ORDER BY count(movies.movieid) DESC LIMIT 1
Database: movielens
Question: List the cast and the director of the movie with the id 1949144.
SQL: SELECT movies2actors.actorid, movies2directors.directorid FROM movies2actors INNER JOIN movies2directors ON movies2actors.movieid = movies2directors.movieid WHERE movies2actors.movieid = 1949144
Database: movielens
Note: UK is a country;
Question: Among the actors who acted in UK movies, what percentage of actors received a rating of at least 3?
SQL: SELECT cast(sum(iif(actors.a_quality >= 3, 1, 0)) AS REAL) * 100 / count(movies.movieid) FROM movies INNER JOIN movies2actors ON movies.movieid = movies2actors.movieid INNER JOIN actors ON movies2actors.actorid = actors.actorid WHERE movies.country = 'UK'
Database: movielens
Note: 'box office success paradox' means average revenue exceeds their quality; The proportion can be computed by [(avg_revenue > d_quality) / ()] * 100%;
Question: What is the proportion of action movies directors who are called 'box office success paradox'?
SQL: SELECT cast(sum(iif(directors.avg_revenue > directors.d_quality, 1, 0)) AS REAL) * 100 / count(movies2directors.movieid) FROM movies2directors INNER JOIN directors ON movies2directors.directorid = directors.directorid WHERE movies2directors.genre = 'Action'
Database: movielens
Note: year contains relative value, higher year value refers to newer date; year = 4 refers to newest date;
Question: Please list the actor IDs whose movies have the newest published date.
SQL: SELECT movies2actors.actorid FROM movies2actors INNER JOIN movies ON movies2actors.movieid = movies.movieid WHERE movies.year = 4
Database: movielens
Note: isenglish = 'T' means English movie;
Question: Who are cast members in an English movie which has a running time equal to 2? Please list their IDs.
SQL: SELECT movies2actors.actorid FROM movies INNER JOIN movies2actors ON movies.movieid = movies2actors.movieid WHERE movies.runningtime = 2 AND movies.isenglish = 'T'
Database: movielens
Note: France is a country;
Question: Which actor has acted in at least 2 French films? Please list their IDs.
SQL: SELECT movies2actors.actorid FROM movies INNER JOIN movies2actors ON movies.movieid = movies2actors.movieid WHERE movies.country = 'France' GROUP BY movies2actors.actorid HAVING count(movies.movieid) > 2
Database: movielens
Note: USA is a country;
Question: How many American movies have cast number more than 1?
SQL: SELECT count(movies2actors.actorid) FROM movies INNER JOIN movies2actors ON movies.movieid = movies2actors.movieid WHERE movies.country = 'USA' AND movies2actors.cast_num > 1
Database: movielens
Note: year contains relative value, higher year value refers to newer date; year = 1 refer to oldest date;
Question: Please list movie IDs which has the oldest publication date and the cast numbers are zero.
SQL: SELECT DISTINCT movies.movieid FROM movies INNER JOIN movies2actors ON movies.movieid = movies2actors.movieid WHERE movies.year = 1 AND movies2actors.cast_num = 0
Database: movielens
Note: US and UK are 2 countries;
Question: How many actors have acted in both US or UK films?
SQL: SELECT count(movies2actors.actorid) FROM movies2actors INNER JOIN movies ON movies2actors.movieid = movies.movieid WHERE movies.country = 'USA' OR movies.country = 'UK'
Database: movielens
Question: How many directors with average revenue of 4 have made either action or adventure films?
SQL: SELECT count(directors.directorid) FROM directors INNER JOIN movies2directors ON directors.directorid = movies2directors.directorid WHERE directors.avg_revenue = 4 AND (movies2directors.genre = 'Adventure' OR movies2directors.genre = 'Action')
Database: movielens
Question: Please list director IDs who have the quality of at least 3 and have made at least 2 different genres of movies.
SQL: SELECT directors.directorid FROM directors INNER JOIN movies2directors ON directors.directorid = movies2directors.directorid WHERE directors.d_quality >= 3 GROUP BY directors.directorid HAVING count(movies2directors.movieid) >= 2
Database: movielens
Note: USA is a country;
Question: How many American comedies are there?
SQL: SELECT count(movies.movieid) FROM movies INNER JOIN movies2directors ON movies.movieid = movies2directors.movieid WHERE movies.country = 'USA' AND movies2directors.genre = 'comedy'
Database: movielens
Question: How many latest released dramas and action movies?
SQL: SELECT count(movies2directors.movieid) FROM movies2directors INNER JOIN movies ON movies2directors.movieid = movies.movieid WHERE movies.year = 4 AND movies2directors.genre IN ('Action', 'drama')
Database: movielens
Note: Higher value of running time means running time is longer;
Question: What horror movies have a running time of at least 2? Please list movie IDs.
SQL: SELECT movies2directors.movieid FROM movies2directors INNER JOIN movies ON movies2directors.movieid = movies.movieid WHERE movies.runningtime >= 2 AND movies2directors.genre = 'Horror'
Database: movielens
Note: 'negative critical reception' refers to percentage of movies with a rating of 1, which = [count(rating = 1) / count(all movies)] * 100%;
Question: Please calculate negative critical reception of American movies
SQL: SELECT cast(sum(iif(u2base.rating = 1, 1, 0)) AS REAL) * 100 / count(u2base.movieid) FROM u2base INNER JOIN movies ON u2base.movieid = movies.movieid WHERE movies.country = 'USA'
Database: movielens
Question: What is the disparate number of the comedy films that got the 1 rating?
SQL: SELECT count(DISTINCT movies2directors.movieid) FROM movies2directors INNER JOIN u2base ON movies2directors.movieid = u2base.movieid WHERE u2base.rating = 1 AND movies2directors.genre = 'comedy'
Database: movielens
Question: What's different average revenue status for director who directed the movie that got the most 1 ratings?
SQL: SELECT DISTINCT directors.avg_revenue FROM directors INNER JOIN movies2directors ON directors.directorid = movies2directors.directorid WHERE directors.d_quality = 5
Database: movielens
Note: France is a country;
Question: How many French movies got the highest ranking?
SQL: SELECT count(movieid) FROM movies WHERE country = 'France' AND movieid IN ( SELECT movieid FROM u2base WHERE rating = ( SELECT max(rating) FROM u2base ) )
Database: movielens
Question: List the movie that has been rated most by 25 years old users.
SQL: SELECT u2base.movieid FROM users INNER JOIN u2base ON users.userid = u2base.userid WHERE users.age = 25 GROUP BY u2base.movieid ORDER BY count(users.userid) DESC LIMIT 1
Database: movielens
Note: UK is a country;
Question: How many separate 35 year-old uesers have rated the movie from UK?
SQL: SELECT count(DISTINCT u2base.userid) FROM movies INNER JOIN u2base ON movies.movieid = u2base.movieid INNER JOIN users ON u2base.userid = users.userid WHERE movies.country = 'UK' AND users.age = 35
Database: movielens
Question: List the user ids and ages who gave the rate 2 to the movie No. 2409051.
SQL: SELECT users.userid, users.age FROM users INNER JOIN u2base ON users.userid = u2base.userid WHERE u2base.movieid = '2409051' AND u2base.rating = 2
Database: movielens
Note: Films and movies share the same meaning; oldest film refers to the movie with year = 1;
Question: Please give the ids of the oldest films that got the most ratings.
SQL: SELECT DISTINCT u2base.movieid FROM u2base INNER JOIN movies ON u2base.movieid = movies.movieid WHERE u2base.rating = 5 AND movies.year = 1
Database: movielens
Note: France is a country;
Question: Which different movies from France got the least ratings?
SQL: SELECT DISTINCT u2base.movieid FROM u2base INNER JOIN movies ON u2base.movieid = movies.movieid WHERE movies.country = 'France' AND u2base.rating = 1
Database: movielens
Note: French and USA are two countries; Female actors mean that a_gender = 'F';
Question: How many female actors have been played a role in any of French or USA movies?
SQL: SELECT count(movies2actors.actorid) FROM movies INNER JOIN movies2actors ON movies.movieid = movies2actors.movieid WHERE movies.country IN ('France', 'USA')
Database: movielens
Note: highest rating of a movie is 5;
Question: How many different actors have played a role in the highest rating movie?
SQL: SELECT count(DISTINCT movies2actors.actorid) FROM u2base INNER JOIN movies2actors ON u2base.movieid = movies2actors.movieid WHERE u2base.rating = 5
Database: movielens
Question: Which Crime film got the lowest average rating?
SQL: SELECT u2base.movieid FROM u2base INNER JOIN movies2directors ON u2base.movieid = movies2directors.movieid WHERE movies2directors.genre = 'Crime' GROUP BY u2base.movieid ORDER BY avg(u2base.rating) LIMIT 1
Database: movielens
Note: UK is a country; Male actors mean that a_gender = 'M'; Female actors mean that a_gender = 'F'; ratio; ratio of gender in actors = count(a_gender = 'M') / a_gender = 'F';
Question: What's the ratio of gender in actors to actress in all the UK movies?
SQL: SELECT cast(sum(iif(actors.a_gender = 'M', 1, 0)) AS REAL) / sum(iif(actors.a_gender = 'F', 1, 0)) FROM movies INNER JOIN movies2actors ON movies.movieid = movies2actors.movieid INNER JOIN actors ON movies2actors.actorid = actors.actorid WHERE movies.country = 'UK'
Database: movielens
Note: Female users mean that u_gender = 'F';
Question: How many 35-year-old female users gave the movie 1711133 a rating of 3?
SQL: SELECT count(users.userid) FROM users INNER JOIN u2base ON users.userid = u2base.userid WHERE u2base.rating = 3 AND u2base.movieid = '1711133' AND users.age = 35 AND users.u_gender = 'F'
Database: movielens
Note: second newest movies refers to year = 2 since year in this database is a relative value, less is the newer;
Question: How many users have rated 1 each for the UK's second newest movies with a running time of 2?
SQL: SELECT count(u2base.userid) FROM movies INNER JOIN u2base ON movies.movieid = u2base.movieid WHERE movies.country = 'UK' AND movies.runningtime = 2 AND u2base.rating = 1 AND movies.year = 2
Database: movielens
Question: How many unique directors with an average earnings of 2 and a quality of 3 have not made comedy films? List them.
SQL: SELECT DISTINCT directors.directorid FROM directors INNER JOIN movies2directors ON directors.directorid = movies2directors.directorid WHERE directors.d_quality = 3 AND directors.avg_revenue = 2 AND movies2directors.genre != 'Comedy'
Database: movielens
Note: Female actors mean that a_gender = 'F'; percentage can be computed by [cast_num = 2 AND a_quality = 2 in female) / (all female actors)] * 100%;
Question: Calculate the percentage of female actors and quality 2 who have appeared twice at the casting of the film 1672580.
SQL: SELECT cast(sum(iif(movies2actors.cast_num = 2 AND actors.a_quality = 2, 1, 0)) AS REAL) * 100 / count(actors.actorid) FROM actors INNER JOIN movies2actors ON actors.actorid = movies2actors.actorid WHERE movies2actors.movieid = 1672580 AND actors.a_gender = 'F'
Database: movielens
Note: The worst actors means a_quality = 0; Men and male share the same meaning; men actors refers to a_gender = 'M';
Question: How many of the worst actors are men and how many of the worst actors are women? Indicate your answer in ratio form.
SQL: SELECT cast(sum(iif(a_gender = 'M', 1, 0)) AS REAL) / sum(iif(a_gender = 'F', 1, 0)) FROM actors WHERE a_quality = 0
Database: movielens
Question: Which actor has appeared in the most films?
SQL: SELECT actorid FROM movies2actors GROUP BY actorid ORDER BY count(movieid) DESC LIMIT 1
Database: movielens
Note: Most popular genre indicates that the genre has the most number of movies;
Question: What is the most popular genre of film directed by directors?
SQL: SELECT genre FROM movies2directors GROUP BY genre ORDER BY count(movieid) DESC LIMIT 1
Database: movielens
Note: d_quality = 5 refers to the best directors, d_quality = 0 refers to the worst directors;
Question: What are the most common film genres made by the worst directors?
SQL: SELECT movies2directors.genre FROM directors INNER JOIN movies2directors ON directors.directorid = movies2directors.directorid WHERE directors.d_quality = 0 GROUP BY movies2directors.genre ORDER BY count(movies2directors.movieid) DESC LIMIT 1
Database: movielens
Note: USA is a country; non-English means isenglish = 'F';
Question: What non-English American film/s has received the lowest user ratings? Mention the movie's I.D.
SQL: SELECT u2base.movieid FROM movies INNER JOIN u2base ON movies.movieid = u2base.movieid WHERE movies.isenglish = 'F' AND movies.country = 'USA' ORDER BY u2base.rating LIMIT 1
Database: movielens
Question: What is the total average movie directed by the directors who's quality and revenue is 4?
SQL: SELECT cast(sum(CASE WHEN directors.d_quality = 4 AND directors.avg_revenue = 4 THEN 1 ELSE 0 END) AS REAL) / count(movies2directors.movieid) FROM directors INNER JOIN movies2directors ON directors.directorid = movies2directors.directorid
Database: movielens
Note: Female users mean that u_gender = 'F';
Question: Which movies have received the greatest ratings from female users whose occupations fall within the category of 3?
SQL: SELECT u2base.movieid FROM users INNER JOIN u2base ON users.userid = u2base.userid INNER JOIN movies ON u2base.movieid = movies.movieid WHERE users.u_gender = 'F' AND users.occupation = 3 AND u2base.rating = 5
Database: movielens
Note: female actresses mean that a_gender = 'F';
Question: How many female actresses appeared in the movie 2312852, what country was it in, and what was it's running time?
SQL: SELECT sum(iif(actors.a_gender = 'F', 1, 0)) , movies.country, movies.runningtime FROM actors INNER JOIN movies2actors ON actors.actorid = movies2actors.actorid INNER JOIN movies ON movies2actors.movieid = movies.movieid WHERE movies2actors.movieid = 2312852 GROUP BY movies.country, movies.runningtime
Database: movielens
Note: d_quality = 5 refers to direct the best, d_quality = 0 refers to direct the worst;
Question: How many horror movies were made by the worst directors?
SQL: SELECT count(movies2directors.movieid) FROM movies2directors INNER JOIN movies ON movies2directors.movieid = movies.movieid INNER JOIN directors ON movies2directors.directorid = directors.directorid WHERE movies2directors.genre = 'horror' AND directors.d_quality = 0
Database: movielens
Note: isenglish = 'T' means films in English; Film and movie share the same meaning;
Question: What are the genres of all the English-language foreign films having a runtime of two hours or less? List each one.
SQL: SELECT movies2directors.genre FROM movies INNER JOIN movies2directors ON movies.movieid = movies2directors.movieid WHERE movies.runningtime <= 2 AND movies.isenglish = 'T' AND movies.country = 'other'
Database: movielens
Note: UK is a country;
Question: Among the English comedy movies produced in the UK, how many movies with a running time of 3 was rated the highest by users between the age 45-50? Indicate the movie names.
SQL: SELECT DISTINCT movies.movieid FROM movies INNER JOIN movies2directors ON movies.movieid = movies2directors.movieid INNER JOIN u2base ON movies.movieid = u2base.movieid INNER JOIN users ON u2base.userid = users.userid WHERE movies.country = 'UK' AND movies2directors.genre = 'Comedy' AND movies.runningtime = 3 AND u2base.rating = 5 AND users.age BETWEEN 45 AND 50 AND movies.isenglish = 'T'
Database: movielens
Note: non-English-language refers to isenglish = 'F'; The percentage difference can be computed by [count(isenglish = 'T' in movies) - count(isenglish = 'F' in movies) / (all movies)] * 100%;
Question: What is the percentage difference of English and non-English-language crime movies in other countries in year 3?
SQL: SELECT cast(sum(iif(movies.isenglish = 'T', 1, 0)) - sum(iif(movies.isenglish = 'F', 1, 0)) AS REAL) * 100 / count(movies.movieid) FROM movies INNER JOIN movies2directors ON movies.movieid = movies2directors.movieid WHERE movies.country = 'other' AND movies.year = 3