problem
stringlengths 121
422
| db_id
stringclasses 69
values | solution
stringlengths 23
804
|
---|---|---|
Write SQL query to solve given problem: Which country has the lowest percentage of arable land?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT CountryName FROM Indicators WHERE IndicatorName LIKE 'Arable land (% of land area)' ORDER BY Value DESC LIMIT 1 |
Write SQL query to solve given problem: Which countries in the upper middle income category still have unfinished external debt reporting? Please provide the country codes in your answer.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT CountryCode FROM Country WHERE IncomeGroup = 'Upper middle income' AND ExternalDebtReportingStatus = 'Preliminary' |
Write SQL query to solve given problem: What is the percentage of countries in the Middle East and North Africa that have finished reporting on their real external debt?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT CAST(SUM(CASE WHEN ExternalDebtReportingStatus = 'Actual' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(CountryCode) FROM Country WHERE region = 'Middle East & North Africa' |
Write SQL query to solve given problem: Which form of government has more countries that have completed the actual external debt reporting between the two types of government accounting concepts, budgetary central government vs. consolidated central government?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT SUM(CASE WHEN GovernmentAccountingConcept = 'Budgetary central government' THEN 1 ELSE 0 END), SUM(CASE WHEN GovernmentAccountingConcept = 'Consolidated central government' THEN 1 ELSE 0 END) central_nums FROM country WHERE ExternalDebtReportingStatus = 'Actual' |
Write SQL query to solve given problem: What proportion of Sub-Saharan Africa's countries have lower middle incomes?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT SUM(CASE WHEN IncomeGroup = 'Lower middle income' THEN 1 ELSE 0 END) * 100.0 / COUNT(CountryCode) persentage FROM Country WHERE Region = 'Sub-Saharan Africa' |
Write SQL query to solve given problem: From 1961 to 1980, what was the highest percentage of land used for agriculture in the Republic of Benin?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT MAX(T1.Value) FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Year >= 1961 AND T1.Year < 1981 AND T1.IndicatorName LIKE 'Agricultural land (% of land area)' AND T2.LongName = 'Republic of Benin' |
Write SQL query to solve given problem: Please list the full names of any three countries that have their series code with a description of UN Energy Statistics (2014).. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT DISTINCT T2.LongName FROM CountryNotes AS T1 INNER JOIN Country AS T2 ON T1.Countrycode = T2.CountryCode WHERE T1.Description = 'Sources: UN Energy Statistics (2014)' LIMIT 3 |
Write SQL query to solve given problem: What was the deposit interest rate in the Commonwealth of Australia in 1979 in percentage?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT T1.Value FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.LongName = 'Commonwealth of Australia' AND T1.IndicatorName = 'Deposit interest rate (%)' AND T1.Year = 1979 |
Write SQL query to solve given problem: How many countries are having their country's footnotes described as "unspecified"? Please provide the full names of any three of those countries.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT COUNT(DISTINCT T1.CountryCode) FROM Country AS T1 INNER JOIN Footnotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Unspecified' OR T2.Description = 'Not specified' UNION SELECT T1.LongName FROM Country AS T1 INNER JOIN Footnotes AS T2 ON T1.CountryCode = T2.Countrycode WHERE T2.Description = 'Unspecified' OR T2.Description = 'Not specified' LIMIT 4 |
Write SQL query to solve given problem: Which nation completed its external debt reporting in 1980 and had a Land under cereal production value of 3018500?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT T2.CountryCode FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IndicatorName LIKE 'Land under cereal production%' AND T1.Value = 3018500 AND T1.Year = 1980 AND T2.ExternalDebtReportingStatus = 'Actual' |
Write SQL query to solve given problem: What portion of the nations in Latin America and the Caribbean had more than 50% of their land used for agriculture in 1961?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT CAST(SUM(CASE WHEN T1.Value > 50 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.CountryCode) FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Year = 1961 AND T2.Region = 'Latin America & Caribbean' AND indicatorname = 'Agricultural land (% of land area)' |
Write SQL query to solve given problem: What are the full names of the countries in South Asia that belongs to the low income group?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT LongName FROM Country WHERE IncomeGroup = 'Low income' AND Region = 'South Asia' |
Write SQL query to solve given problem: What is the indicator code for Mobile Cellular Subscriptions of Brazil?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT DISTINCT IndicatorCode FROM Indicators WHERE CountryName = 'Brazil' AND IndicatorName = 'Mobile cellular subscriptions' |
Write SQL query to solve given problem: How many countries in Europe & Central Asia uses Danish krone as its currency? List the full names of those coutnries.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT COUNT(longname) FROM country WHERE region = 'Europe & Central Asia' AND currencyunit = 'Danish krone' UNION SELECT longname FROM country WHERE currencyunit = 'Danish krone' AND region = 'Europe & Central Asia' |
Write SQL query to solve given problem: What is the name of the country with the highest percentage of rural population in the overall total population? Indicate the rural population percentage of total population.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT countryname, MAX(value) FROM indicators WHERE indicatorname = 'Rural population (% of total population)' |
Write SQL query to solve given problem: How many countries have a latest population census in 2011? Indicate their full names.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT COUNT(LongName) FROM country WHERE LatestPopulationCensus = '2011' UNION ALL SELECT LongName FROM country WHERE LatestPopulationCensus = '2011' |
Write SQL query to solve given problem: What is the agricultural land area in sq. km of Italy in 1968?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT Value FROM Indicators WHERE IndicatorName = 'Agricultural land (sq. km)' AND Year = 1968 AND CountryName = 'Italy' |
Write SQL query to solve given problem: In Sub-Saharan Africa, how many female out-of-school children of primary school age are there in the country with the higest number of female out-of-school children of primary school age? Indicate the year of when it was recorded.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT MAX(T1.value), T1.year FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Region = 'Sub-Saharan Africa' AND T1.IndicatorName = 'Out-of-school children of primary school age, female (number)' |
Write SQL query to solve given problem: What is the series code for number of infant deaths in year 1965 for the country whose full name is Islamic State of Afghanistan?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT DISTINCT T3.Seriescode FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode INNER JOIN CountryNotes AS T3 ON T2.CountryCode = T3.Countrycode WHERE T2.IndicatorName = 'Number of infant deaths' AND T1.LongName = 'Islamic State of Afghanistan' AND T2.Year = 1965 |
Write SQL query to solve given problem: Among the countries who uses the 1968 System of National Accounts methodology, how many are in the Middle East & North Africa? Name the country with the highest CO2 emissions from solid fuel consumption in kiloton.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT COUNT(DISTINCT T1.CountryCode) FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Region = 'Middle East & North Africa' AND T2.SystemOfNationalAccounts = 'Country uses the 1968 System of National Accounts methodology.' AND T1.IndicatorName = 'CO2 emissions FROM solid fuel consumption (kt)' UNION SELECT * FROM ( SELECT T1.CountryName FROM indicators AS T1 INNER JOIN country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Region = 'Middle East & North Africa' AND T2.SystemOfNationalAccounts = 'Country uses the 1968 System of National Accounts methodology.' AND T1.IndicatorName = 'CO2 emissions FROM solid fuel consumption (kt)' GROUP BY T1.CountryName ORDER BY SUM(T1.value) DESC LIMIT 1 ) |
Write SQL query to solve given problem: What are the indicator codes for the Republic of Albania in the year 1960?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT DISTINCT T1.IndicatorCode FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Year = 1960 AND T2.LongName = 'Republic of Albania' |
Write SQL query to solve given problem: What is the lending category of the country with a cereal production of 6140000 metric tons for the year 1966?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT T1.LendingCategory FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Cereal production (metric tons)' AND T2.Value = 6140000 AND T2.Year = 1966 |
Write SQL query to solve given problem: Which country has the highest population in largest city for 19 consecutive years starting from 1960? Indicate the region to which the country is located.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT T2.CountryCode, T2.Region FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IndicatorName = 'Population in largest city' AND T1.Year >= 1960 AND T1.Year < 1980 ORDER BY T2.Region DESC LIMIT 1 |
Write SQL query to solve given problem: From 1975 to 1980, how much is the total amount CO2 emmission in kiloton of the the world? Indicate which year the world recorded its highest CO2 emmissions.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT SUM(T1.Value), T1.Year FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IndicatorName = 'CO2 emissions (kt)' AND T1.Year >= 1975 AND T1.Year < 1981 AND T1.CountryCode = 'WLD' AND T2.SpecialNotes = 'World aggregate.' |
Write SQL query to solve given problem: Which country has the smallest land area in square kilometers for 19 consecutive years starting from year 1961? Indicate how much is its land area in square kilometers in those years and the income group of the country.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT T1.CountryName, SUM(T1.Value) area, T2.IncomeGroup FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IndicatorName = 'Land area (sq. km)' AND T1.Year >= 1961 AND T1.Year < 1980 GROUP BY T1.CountryCode ORDER BY SUM(T1.Value) ASC LIMIT 1 |
Write SQL query to solve given problem: What is the average number of passengers carried via air transport per year by Bulgaria between 1970 to 1980? Indicate the country's system of trade.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT AVG(T1.Value), T2.SystemOfTrade FROM Indicators AS T1 INNER JOIN Country AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.IndicatorName = 'Air transport, passengers carried' AND T1.Year >= 1970 AND T1.Year < 1981 AND T1.CountryName = 'Bulgaria' |
Write SQL query to solve given problem: In which years does the country whose Alpha2Code is 1A have a result of the indicator Adolescent fertility rate?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT T2.Year FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' |
Write SQL query to solve given problem: What's the long name of the country that got 3000000 on the indicator Arms exports in 1960?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT T1.LongName FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Arms exports (SIPRI trend indicator values)' AND T2.Year = 1960 AND T2.Value = 3000000 |
Write SQL query to solve given problem: Please list the Alpha2Codes of all the countries that have an indicator on Rural population in 1960.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT T1.Alpha2Code FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.IndicatorName = 'Rural population' AND T2.Year = 1960 |
Write SQL query to solve given problem: Which country's indicator for Adolescent fertility rate is the highest in 1960, please give its special notes.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT DISTINCT T1.CountryCode, T1.SpecialNotes FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T2.Value = ( SELECT Value FROM Indicators WHERE IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND Year = 1960 ORDER BY Value DESC LIMIT 1 ) |
Write SQL query to solve given problem: By how much did the indicator on Adolescent fertility rate increase from 1960 to 1961 in the country whose Alpha2Code is 1A?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT ( SELECT T2.Value FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND T2.Year = 1961 ) - ( SELECT T2.Value FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND T2.Year = 1960 ) DIFF |
Write SQL query to solve given problem: Please list the notes for Aruba on the indicators under the topic of Environment: Energy production & use.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT T2.Description FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T1.ShortName = 'Aruba' AND T3.Topic = 'Environment: Energy production & use' |
Write SQL query to solve given problem: For the country that has notes on the indicator Inflation, consumer prices, in which region is it in?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT T1.Region FROM Country AS T1 INNER JOIN CountryNotes AS T2 ON T1.CountryCode = T2.Countrycode INNER JOIN Series AS T3 ON T2.Seriescode = T3.SeriesCode WHERE T3.IndicatorName = 'Inflation, consumer prices (annual %)' |
Write SQL query to solve given problem: How many countries have notes on the indicator Stocks traded, turnover ratio of domestic shares?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT COUNT(T1.Countrycode) FROM CountryNotes AS T1 INNER JOIN Series AS T2 ON T1.Seriescode = T2.SeriesCode WHERE T2.IndicatorName = 'Stocks traded, turnover ratio of domestic shares (%)' |
Write SQL query to solve given problem: What's the agregation method for the indicator whose value is 133 in 1960 for the Arab World?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT T2.AggregationMethod FROM Indicators AS T1 INNER JOIN Series AS T2 ON T1.IndicatorName = T2.IndicatorName INNER JOIN Country AS T3 ON T1.CountryCode = T3.CountryCode WHERE T3.ShortName = 'Arab World' AND T1.Value = 133 AND T1.Year = 1960 |
Write SQL query to solve given problem: What's the value of the indicator whose long definition is "Adolescent fertility rate is the number of births per 1,000 women ages 15-19." for the Arab World in 1960?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT T1.Value FROM Indicators AS T1 INNER JOIN Series AS T2 ON T1.IndicatorName = T2.IndicatorName INNER JOIN Country AS T3 ON T1.CountryCode = T3.CountryCode WHERE T2.LongDefinition = 'Adolescent fertility rate is the number of births per 1,000 women ages 15-19.' AND T3.ShortName = 'Arab World' AND T1.Year = 1960 |
Write SQL query to solve given problem: What is the percentage of increase of the indicator on Adolescent fertility rate from 1960 to 1961 in the country whose Alpha2Code is 1A?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT (( SELECT T2.Value FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND T2.Year = 1961 ) - ( SELECT T2.Value FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND T2.Year = 1960 )) * 1.0 / ( SELECT SUM(T2.Value) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' AND T2.Year = 1960 ) |
Write SQL query to solve given problem: What is the average value of Adolescent fertility rate in the country whose Alpha2Code is 1A?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | world_development_indicators | SELECT CAST(SUM(T2.Value) AS REAL) * 100 / COUNT(T2.Year) FROM Country AS T1 INNER JOIN Indicators AS T2 ON T1.CountryCode = T2.CountryCode WHERE T1.Alpha2Code = '1A' AND T2.IndicatorName = 'Adolescent fertility rate (births per 1,000 women ages 15-19)' |
Write SQL query to solve given problem: List the different director IDs of the movies whose user rating is more than 4.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT DISTINCT T2.directorid FROM u2base AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.rating > 4 |
Write SQL query to solve given problem: Among the users who gave a rating of 5, how many of them are male?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(T1.userid) FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid WHERE T1.rating = 5 AND T2.u_gender = 'M' |
Write SQL query to solve given problem: List the genres of the movies which actor id 851 is the star.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.genre FROM movies2actors AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T1.actorid = T3.actorid WHERE T3.actorid = 851 |
Write SQL query to solve given problem: How many movies from the USA which user rating is less than 3?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(T1.movieid) FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA' AND T1.rating < 3 |
Write SQL query to solve given problem: Among the movies from France, how many of them are drama?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(T1.movieid) FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'France' AND T1.genre = 'drama' |
Write SQL query to solve given problem: What is the average occupation of users whose ratings are not more than 2 ?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT AVG(T2.occupation) FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid WHERE T1.rating < 2 |
Write SQL query to solve given problem: List the top 10 USA movies, by descending order, from the highest to the lowest, the user rating.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T1.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'USA' GROUP BY T1.movieid ORDER BY AVG(T1.rating) DESC LIMIT 10 |
Write SQL query to solve given problem: What is the average number of casts of movies that are from the USA?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT AVG(T2.cast_num) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'USA' |
Write SQL query to solve given problem: List the top 5 movies from other countries which to language is not in English.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT DISTINCT T1.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'other' AND T2.isEnglish = 'F' LIMIT 5 |
Write SQL query to solve given problem: Among the best actors, how many of them got a rating of 5 to the movies they starred?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(T1.actorid) FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid INNER JOIN u2base AS T3 ON T2.movieid = T3.movieid WHERE T1.a_quality = 5 AND T3.rating = 5 |
Write SQL query to solve given problem: What is the average rating of the newest movies from France?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT AVG(T1.rating) FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'france' AND T2.year = 4 |
Write SQL query to solve given problem: Among the most rated UK movies, how many of them has running time of less than 2?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(T1.movieid) FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'UK' AND T2.runningtime < 2 AND T1.rating = 5 |
Write SQL query to solve given problem: List the id of male users who gave ratings of less than 3 to French movies with running time of 2.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T1.userid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid INNER JOIN users AS T3 ON T1.userid = T3.userid WHERE T2.country = 'France' AND T2.runningtime = 2 AND T1.rating < 3 AND T3.u_gender = 'M' |
Write SQL query to solve given problem: Among the worst actresses, how many of them got a rating of more than 3 to the movies they starred?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(T1.userid) FROM u2base AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T2.actorid = T3.actorid INNER JOIN users AS T4 ON T1.userid = T4.userid WHERE T3.a_quality = 0 AND T1.rating > 3 AND T4.u_gender = 'F' |
Write SQL query to solve given problem: What is the ID of audiences that gave the most rating of 5?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT userid FROM u2base WHERE rating = 5 GROUP BY userid ORDER BY COUNT(movieid) DESC LIMIT 1 |
Write SQL query to solve given problem: What are the ID of actors that had worked together with director 22397? What was the genre of that movie?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.actorid, T4.genre FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T2.actorid = T3.actorid INNER JOIN movies2directors AS T4 ON T1.movieid = T4.movieid WHERE T4.directorid = 22397 |
Write SQL query to solve given problem: Please list down the ID of actors and directors in action movies.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.actorid, T1.directorid FROM movies2directors AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.genre = 'Action' |
Write SQL query to solve given problem: How many female actors acted in the movies of year 4?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(T2.actorid) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T2.actorid = T3.actorid WHERE T3.a_gender = 'F' AND T1.year = 4 |
Write SQL query to solve given problem: What are the ID of actors with quality rating of 3 acted in English USA movies?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.actorid FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T2.actorid = T3.actorid WHERE T3.a_quality = 3 AND T1.country = 'USA' AND T1.isEnglish = 'T' |
Write SQL query to solve given problem: List down the ID of movies with running time of 3 and average revenue of 1?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T1.movieid FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid INNER JOIN directors AS T3 ON T2.directorid = T3.directorid WHERE T1.runningtime = 3 AND T3.avg_revenue = 1 |
Write SQL query to solve given problem: UK produced what genre of movies?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.genre FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'UK' |
Write SQL query to solve given problem: What is the favourite movie genre for audiences of age 18?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T1.genre FROM movies2directors AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid INNER JOIN users AS T3 ON T2.userid = T3.userid WHERE T3.age = 18 GROUP BY T1.genre ORDER BY COUNT(T1.movieid) DESC LIMIT 1 |
Write SQL query to solve given problem: What is the ID of actors that acted in the movies most viewed by audience with occupation 5?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T3.actorid FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid INNER JOIN movies2actors AS T3 ON T2.movieid = T3.movieid WHERE T1.occupation = 5 GROUP BY T2.movieid ORDER BY COUNT(T1.userid) DESC LIMIT 1 |
Write SQL query to solve given problem: Movies with rating 3 are viewed by audiences in which distinct age group?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT DISTINCT T2.age FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid WHERE T1.rating = 3 |
Write SQL query to solve given problem: Action movies are mostly directed by directors of which country?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T3.country FROM movies2directors AS T1 INNER JOIN directors AS T2 ON T1.directorid = T2.directorid INNER JOIN movies AS T3 ON T1.movieid = T3.movieid WHERE T1.genre = 'Action' GROUP BY T3.country ORDER BY COUNT(T3.country) DESC LIMIT 1 |
Write SQL query to solve given problem: Please list down ID of movies acted by top 5 actors based on actor rating.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.movieid FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid GROUP BY T2.actorid ORDER BY AVG(T1.a_quality) DESC LIMIT 5 |
Write SQL query to solve given problem: List down 5 non English adventure movies from UK?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T1.movieid FROM movies2directors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'UK' AND T1.genre = 'Adventure' AND T2.isEnglish = 'F' LIMIT 5 |
Write SQL query to solve given problem: What is the percentage of female audiences who viewed movies with rating 2?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT CAST(SUM(IIF(T2.u_gender = 'F', 1, 0)) AS REAL) * 100 / COUNT(T2.userid) FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid WHERE T1.rating = 2 |
Write SQL query to solve given problem: What is the difference of female and male audiences in number who viewed horror movies?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT SUM(IIF(T2.u_gender = 'F', 1, 0)) - SUM(IIF(T2.u_gender = 'M', 1, 0)) FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid INNER JOIN movies2directors AS T3 ON T3.movieid = T1.movieid WHERE T3.genre = 'horror' |
Write SQL query to solve given problem: Please list the genre of the movies that are the newest and is in English.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.genre FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.year = 4 AND T1.isEnglish = 'T' |
Write SQL query to solve given problem: Among the action movies from the USA, how many of them are not in English?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(T1.movieid) FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'USA' AND T1.isEnglish = 'F' AND T2.genre = 'Action' |
Write SQL query to solve given problem: For the male users no older than 18, how many times have they given the highest rating?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(T1.movieid) FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid WHERE T1.rating = 5 AND T2.age < 18 AND T2.u_gender = 'M' |
Write SQL query to solve given problem: Please list the ID of the movie that has been mostly rated by female users.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T1.movieid FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid WHERE T2.u_gender = 'F' GROUP BY T1.movieid ORDER BY COUNT(T2.userid) DESC LIMIT 1 |
Write SQL query to solve given problem: Among divergent movies that got the highest rating, how many of them are from the UK?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(DISTINCT T1.movieid) FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.country = 'UK' AND T1.rating = 5 |
Write SQL query to solve given problem: Please list different IDs of movies that are the newest and have gotten the lowest rating.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT DISTINCT T1.movieid FROM u2base AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.year = 4 AND T1.rating = 1 |
Write SQL query to solve given problem: For the movies in English that are the oldest, how many of them have the lowest rating?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(DISTINCT T1.movieid) FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T1.year = 1 AND T2.rating = 1 AND T1.isEnglish = 'T' |
Write SQL query to solve given problem: How many different female users have rated movies from France?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(DISTINCT T2.userid) FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T1.u_gender = 'F' AND T3.country = 'France' |
Write SQL query to solve given problem: For different directors who direct well, how many of them have directed an action film?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(DISTINCT T2.directorid) FROM movies2directors AS T2 INNER JOIN directors AS T3 ON T2.directorid = T3.directorid WHERE T2.genre = 'Action' AND T3.d_quality = 4 |
Write SQL query to solve given problem: Please list the genre of the movies that are directed by the directors with the highest level of average revenue.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.genre FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.avg_revenue = 4 |
Write SQL query to solve given problem: How many distinct movies in English stars a male actor who acts the best?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(DISTINCT T1.actorid) FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T3.isEnglish = 'T' AND T1.a_gender = 'M' AND T1.a_quality = 5 |
Write SQL query to solve given problem: Please list the country of the movie that stars an actress who acts the worse.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T3.country FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid INNER JOIN movies AS T3 ON T2.movieid = T3.movieid WHERE T1.a_gender = 'F' AND T1.a_quality = 0 |
Write SQL query to solve given problem: What is the highest average rating for action movies made in the USA?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT AVG(T2.rating) FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid INNER JOIN movies2directors AS T3 ON T1.movieid = T3.movieid WHERE T1.country = 'USA' AND T3.genre = 'Action' GROUP BY T1.movieid ORDER BY AVG(T2.rating) DESC LIMIT 1 |
Write SQL query to solve given problem: Among the films directed by directors who direct the best, how many of them have an average rating of over 3.5?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(*) FROM ( SELECT DISTINCT T2.movieid FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid INNER JOIN u2base AS T3 ON T2.movieid = T3.movieid WHERE T1.d_quality = 5 GROUP BY T2.movieid HAVING AVG(T3.rating) > 3.5 ) AS T1 |
Write SQL query to solve given problem: Which adventure movie has the highest average rating?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T1.movieid FROM movies2directors AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T1.genre = 'Adventure' GROUP BY T1.movieid ORDER BY AVG(T2.rating) DESC LIMIT 1 |
Write SQL query to solve given problem: How many of the users who rate the movie with the id '2462959' are female?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(T1.userid) FROM users AS T1 INNER JOIN u2base AS T2 ON T1.userid = T2.userid WHERE T2.userid = 2462959 AND T1.u_gender = 'F' |
Write SQL query to solve given problem: What is the most distinct rated movie with a running time of 0?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT DISTINCT T1.movieid FROM movies AS T1 INNER JOIN u2base AS T2 ON T1.movieid = T2.movieid WHERE T1.runningtime = 0 AND T2.rating = ( SELECT MAX(rating) FROM u2base ) |
Write SQL query to solve given problem: List the ids and ratings of each actors played in the movie with the id 1722327?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T1.actorid, T1.a_quality FROM actors AS T1 INNER JOIN movies2actors AS T2 ON T1.actorid = T2.actorid WHERE T2.movieid = 1722327 |
Write SQL query to solve given problem: Which directors with the best quality directed the most films?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T1.directorid FROM directors AS T1 INNER JOIN movies2directors AS T2 ON T1.directorid = T2.directorid WHERE T1.d_quality = 5 GROUP BY T1.directorid ORDER BY COUNT(T2.movieid) DESC LIMIT 1 |
Write SQL query to solve given problem: How many drama movie with the rating of 3?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(DISTINCT T2.movieid) FROM u2base AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T2.genre = 'drama' AND T1.rating = 3 |
Write SQL query to solve given problem: How many of the movies rated 5 are rated by a user between the ages of 25 and 35?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(T1.movieid) FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid WHERE T1.rating = 5 AND T2.age BETWEEN 25 AND 35 |
Write SQL query to solve given problem: Please list all horror films that have a rating of 1.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T1.movieid FROM u2base AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.rating = 1 AND T2.genre = 'Horror' |
Write SQL query to solve given problem: List the IDs of all the directors who worked on French films.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.directorid FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'France' |
Write SQL query to solve given problem: List all of the user ids and ages who rated movies with the id 1695219?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.userid, T2.age FROM u2base AS T1 INNER JOIN users AS T2 ON T1.userid = T2.userid WHERE T1.movieid = 1695219 |
Write SQL query to solve given problem: Which genre contains the greatest number of non-English films?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.genre FROM movies AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.isEnglish = 'F' GROUP BY T2.genre ORDER BY COUNT(T1.movieid) DESC LIMIT 1 |
Write SQL query to solve given problem: List the cast and the director of the movie with the id 1949144.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T1.actorid, T2.directorid FROM movies2actors AS T1 INNER JOIN movies2directors AS T2 ON T1.movieid = T2.movieid WHERE T1.movieid = 1949144 |
Write SQL query to solve given problem: Among the actors who acted in UK movies, what percentage of actors received a rating of at least 3?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT CAST(SUM(IIF(T3.a_quality >= 3, 1, 0)) AS REAL) * 100 / COUNT(T1.movieid) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid INNER JOIN actors AS T3 ON T2.actorid = T3.actorid WHERE T1.country = 'UK' |
Write SQL query to solve given problem: What is the proportion of action movies directors who are called 'box office success paradox'?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT CAST(SUM(IIF(T2.avg_revenue > T2.d_quality, 1, 0)) AS REAL) * 100 / COUNT(T1.movieid) FROM movies2directors AS T1 INNER JOIN directors AS T2 ON T1.directorid = T2.directorid WHERE T1.genre = 'Action' |
Write SQL query to solve given problem: Please list the actor IDs whose movies have the newest published date.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T1.actorid FROM movies2actors AS T1 INNER JOIN movies AS T2 ON T1.movieid = T2.movieid WHERE T2.year = 4 |
Write SQL query to solve given problem: Who are cast members in an English movie which has a running time equal to 2? Please list their IDs.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.actorid FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.runningtime = 2 AND T1.isEnglish = 'T' |
Write SQL query to solve given problem: Which actor has acted in at least 2 French films? Please list their IDs.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT T2.actorid FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'France' GROUP BY T2.actorid HAVING COUNT(T1.movieid) > 2 |
Write SQL query to solve given problem: How many American movies have cast number more than 1?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT COUNT(T2.actorid) FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.country = 'USA' AND T2.cast_num > 1 |
Write SQL query to solve given problem: Please list movie IDs which has the oldest publication date and the cast numbers are zero.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movielens | SELECT DISTINCT T1.movieid FROM movies AS T1 INNER JOIN movies2actors AS T2 ON T1.movieid = T2.movieid WHERE T1.year = 1 AND T2.cast_num = 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.