Database: world_1
# city ( id , name , countrycode , district , population )
# sqlite_sequence ( name , seq )
# country ( code , name , continent , region , surfacearea , indepyear , population , lifeexpectancy , gnp , gnpold , localname , governmentform , headofstate , capital , code2 )
# countrylanguage ( countrycode , language , isofficial , percentage )
# city.countrycode = country.code
# countrylanguage.countrycode = country.code

Question: What are the names of all the countries that became independent after 1950?
SQL: select name from country where indepyear > 1950

Question: Give the names of the nations that were founded after 1950.
SQL: select name from country where indepyear > 1950

Question: How many countries have a republic as their form of government?
SQL: select count ( * ) from country where governmentform = 'Republic'

Question: How many countries have governments that are republics?
SQL: select count ( * ) from country where governmentform = 'Republic'

Question: What is the total surface area of the countries in the Caribbean region?
SQL: select sum ( surfacearea ) from country where region = 'Caribbean'

Question: How much surface area do the countires in the Carribean cover together?
SQL: select sum ( surfacearea ) from country where region = 'Caribbean'

Question: Which continent is Anguilla in?
SQL: select continent from country where name = 'Anguilla'

Question: What is the continent name which Anguilla belongs to?
SQL: select continent from country where name = 'Anguilla'

Question: Which region is the city Kabul located in?
SQL: select region from country join city on country.code = city.countrycode where city.name = 'Kabul'

Question: What region is Kabul in?
SQL: select region from country join city on country.code = city.countrycode where city.name = 'Kabul'

Question: Which language is the most popular in Aruba?
SQL: select countrylanguage.language from country join countrylanguage on country.code = countrylanguage.countrycode where country.name = 'Aruba' order by percentage desc limit 1

Question: What language is predominantly spoken in Aruba?
SQL: select countrylanguage.language from country join countrylanguage on country.code = countrylanguage.countrycode where country.name = 'Aruba' order by percentage desc limit 1

Question: What are the population and life expectancies in Brazil?
SQL: select population , lifeexpectancy from country where name = 'Brazil'

Question: Give me Brazil's population and life expectancies.
SQL: select population , lifeexpectancy from country where name = 'Brazil'

Question: What are the region and population of Angola?
SQL: select population , region from country where name = 'Angola'

Question: What region does Angola belong to and what is its population?
SQL: select population , region from country where name = 'Angola'

Question: What is the average expected life expectancy for countries in the region of Central Africa?
SQL: select avg ( lifeexpectancy ) from country where region = 'Central Africa'

Question: How long is the people's average life expectancy in Central Africa?
SQL: select avg ( lifeexpectancy ) from country where region = 'Central Africa'

Question: What is the name of country that has the shortest life expectancy in Asia?
SQL: select name from country where continent = 'Asia' order by lifeexpectancy asc limit 1

Question: Give the name of the country in Asia with the lowest life expectancy.
SQL: select name from country where continent = 'Asia' order by lifeexpectancy asc limit 1

Question: What is the total population and maximum GNP in Asia?
SQL: select sum ( population ) , max ( gnp ) from country where continent = 'Asia'

Question: How many people live in Asia, and what is the largest GNP among them?
SQL: select sum ( population ) , max ( gnp ) from country where continent = 'Asia'

Question: What is the average life expectancy in African countries that are republics?
SQL: select avg ( lifeexpectancy ) from country where continent = 'Africa' and governmentform = 'Republic'

Question: Give the average life expectancy for countries in Africa which are republics?
SQL: select avg ( lifeexpectancy ) from country where continent = 'Africa' and governmentform = 'Republic'

Question: What is the total surface area of the continents Asia and Europe?
SQL: select sum ( surfacearea ) from country where continent = 'Asia' or continent = 'Europe'

Question: Give the total surface area covered by countries in Asia or Europe.
SQL: select sum ( surfacearea ) from country where continent = 'Asia' or continent = 'Europe'

Question: How many people live in Gelderland district?
SQL: select sum ( population ) from city where district = 'Gelderland'

Question: What is the total population of Gelderland district?
SQL: select sum ( population ) from city where district = 'Gelderland'

Question: What is the average GNP and total population in all nations whose government is US territory?
SQL: select avg ( gnp ) , sum ( population ) from country where governmentform = 'US Territory'

Question: Give the mean GNP and total population of nations which are considered US territory.
SQL: select avg ( gnp ) , sum ( population ) from country where governmentform = 'US Territory'

Question: How many unique languages are spoken in the world?
SQL: select count ( distinct language ) from countrylanguage

Question: What is the number of distinct languages used around the world?
SQL: select count ( distinct language ) from countrylanguage

Question: How many type of governments are in Africa?
SQL: select count ( distinct governmentform ) from country where continent = 'Africa'

Question: How many different forms of governments are there in Africa?
SQL: select count ( distinct governmentform ) from country where continent = 'Africa'

Question: What is the total number of languages used in Aruba?
SQL: select count ( countrylanguage.language ) from country join countrylanguage on country.code = countrylanguage.countrycode where country.name = 'Aruba'

Question: How many languages are spoken in Aruba?
SQL: select count ( countrylanguage.language ) from country join countrylanguage on country.code = countrylanguage.countrycode where country.name = 'Aruba'

Question: How many official languages does Afghanistan have?
SQL: select count ( * ) from country join countrylanguage on country.code = countrylanguage.countrycode where country.name = 'Afghanistan' and isofficial = 'T'

Question: How many official languages are spoken in Afghanistan?
SQL: select count ( * ) from country join countrylanguage on country.code = countrylanguage.countrycode where country.name = 'Afghanistan' and isofficial = 'T'

Question: What is name of the country that speaks the largest number of languages?
SQL: select country.name from country join countrylanguage on country.code = countrylanguage.countrycode group by country.name order by count ( * ) desc limit 1

Question: Give the name of the nation that uses the greatest amount of languages.
SQL: select country.name from country join countrylanguage on country.code = countrylanguage.countrycode group by country.name order by count ( * ) desc limit 1

Question: Which continent has the most diverse languages?
SQL: select country.continent from country join countrylanguage on country.code = countrylanguage.countrycode group by country.continent order by count ( * ) desc limit 1

Question: Which continent speaks the most languages?
SQL: select country.continent from country join countrylanguage on country.code = countrylanguage.countrycode group by country.continent order by count ( * ) desc limit 1

Question: How many countries speak both English and Dutch?
SQL: select count ( * ) from ( select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' intersect select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'Dutch' )

Question: What is the number of nations that use English and Dutch?
SQL: select count ( * ) from ( select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' intersect select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'Dutch' )

Question: What are the names of nations speak both English and French?
SQL: select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' intersect select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'French'

Question: Give the names of nations that speak both English and French.
SQL: select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' intersect select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'French'

Question: What are the names of nations where both English and French are official languages?
SQL: select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' and countrylanguage.isofficial = 'T' intersect select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'French' and countrylanguage.isofficial = 'T'

Question: Give the names of countries with English and French as official languages.
SQL: select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' and countrylanguage.isofficial = 'T' intersect select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'French' and countrylanguage.isofficial = 'T'

Question: What is the number of distinct continents where Chinese is spoken?
SQL: select count ( distinct continent ) from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'Chinese'

Question: How many continents speak Chinese?
SQL: select count ( distinct continent ) from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'Chinese'

Question: What are the regions that use English or Dutch?
SQL: select distinct country.region from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' or countrylanguage.language = 'Dutch'

Question: Which regions speak Dutch or English?
SQL: select distinct country.region from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' or countrylanguage.language = 'Dutch'

Question: What are the countries where either English or Dutch is the official language ?
SQL: select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'english' and isofficial = 't' union select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'dutch' and isofficial = 't'

Question: Which countries have either English or Dutch as an official language?
SQL: select * from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' and isofficial = 'T' union select * from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'Dutch' and isofficial = 'T'

Question: Which language is the most popular on the Asian continent?
SQL: select countrylanguage.language from country join countrylanguage on country.code = countrylanguage.countrycode where country.continent = 'Asia' group by countrylanguage.language order by count ( * ) desc limit 1

Question: What is the language that is used by the largest number of Asian nations?
SQL: select countrylanguage.language from country join countrylanguage on country.code = countrylanguage.countrycode where country.continent = 'Asia' group by countrylanguage.language order by count ( * ) desc limit 1

Question: Which languages are spoken by only one country in republic governments?
SQL: select countrylanguage.language from country join countrylanguage on country.code = countrylanguage.countrycode where country.governmentform = 'Republic' group by countrylanguage.language having count ( * ) = 1

Question: What languages are only used by a single country with a republic government?
SQL: select countrylanguage.language from country join countrylanguage on country.code = countrylanguage.countrycode where country.governmentform = 'Republic' group by countrylanguage.language having count ( * ) = 1

Question: Find the city with the largest population that uses English.
SQL: select city.name , city.population from city join countrylanguage on city.countrycode = countrylanguage.countrycode where countrylanguage.language = 'English' order by city.population desc limit 1

Question: What is the most populace city that speaks English?
SQL: select city.name , city.population from city join countrylanguage on city.countrycode = countrylanguage.countrycode where countrylanguage.language = 'English' order by city.population desc limit 1

Question: Find the name, population and expected life length of asian country with the largest area?
SQL: select name , population , lifeexpectancy from country where continent = 'Asia' order by surfacearea desc limit 1

Question: What are the name, population, and life expectancy of the largest Asian country by land?
SQL: select name , population , lifeexpectancy from country where continent = 'Asia' order by surfacearea desc limit 1

Question: What is average life expectancy in the countries where English is not the official language?
SQL: select avg ( lifeexpectancy ) from country where name not in ( select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' and countrylanguage.isofficial = 'T' )

Question: Give the mean life expectancy of countries in which English is not the official language.
SQL: select avg ( lifeexpectancy ) from country where name not in ( select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' and countrylanguage.isofficial = 'T' )

Question: What is the total number of people living in the nations that do not use English?
SQL: select sum ( population ) from country where name not in ( select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' )

Question: How many people live in countries that do not speak English?
SQL: select sum ( population ) from country where name not in ( select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.language = 'English' )

Question: What is the official language spoken in the country whose head of state is Beatrix?
SQL: select countrylanguage.language from country join countrylanguage on country.code = countrylanguage.countrycode where country.headofstate = 'Beatrix' and countrylanguage.isofficial = 'T'

Question: What is the official language used in the country the name of whose head of state is Beatrix.
SQL: select countrylanguage.language from country join countrylanguage on country.code = countrylanguage.countrycode where country.headofstate = 'Beatrix' and countrylanguage.isofficial = 'T'

Question: What is the total number of unique official languages spoken in the countries that are founded before 1930?
SQL: select count ( distinct countrylanguage.language ) from country join countrylanguage on country.code = countrylanguage.countrycode where indepyear < 1930 and countrylanguage.isofficial = 'T'

Question: For the countries founded before 1930, what is the total number of distinct official languages?
SQL: select count ( distinct countrylanguage.language ) from country join countrylanguage on country.code = countrylanguage.countrycode where indepyear < 1930 and countrylanguage.isofficial = 'T'

Question: What are the countries that have greater surface area than any country in Europe?
SQL: select name from country where surfacearea > ( select min ( surfacearea ) from country where continent = 'Europe' )

Question: Which countries have greater area than that of any country in Europe?
SQL: select name from country where surfacearea > ( select min ( surfacearea ) from country where continent = 'Europe' )

Question: What are the African countries that have a  population less than any country in Asia?
SQL: select name from country where continent = 'Africa' and population < ( select max ( population ) from country where continent = 'Asia' )

Question: Which African countries have a smaller population than that of any country in Asia?
SQL: select name from country where continent = 'Africa' and population < ( select min ( population ) from country where continent = 'Asia' )

Question: Which Asian countries have a population that is larger than any country in Africa?
SQL: select name from country where continent = 'Asia' and population > ( select max ( population ) from country where continent = 'Africa' )

Question: What are the Asian countries which have a population larger than that of any country in Africa?
SQL: select name from country where continent = 'Asia' and population > ( select min ( population ) from country where continent = 'Africa' )

Question: What are the country codes for countries that do not speak English?
SQL: select countrycode from countrylanguage except select countrycode from countrylanguage where language = 'English'

Question: Return the country codes for countries that do not speak English.
SQL: select countrycode from countrylanguage except select countrycode from countrylanguage where language = 'English'

Question: What are the country codes of countries where people use languages other than English?
SQL: select distinct countrycode from countrylanguage where language != 'English'

Question: Give the country codes for countries in which people speak langauges that are not English.
SQL: select distinct countrycode from countrylanguage where language != 'English'

Question: What are the codes of the countries that do not speak English and whose government forms are not Republic?
SQL: select code from country where governmentform != 'Republic' except select countrycode from countrylanguage where language = 'English'

Question: Return the codes of countries that do not speak English and do not have Republics for governments.
SQL: select code from country where governmentform != 'Republic' except select countrycode from countrylanguage where language = 'English'

Question: Which cities are in European countries where English is not the official language?
SQL: select distinct city.name from country join city on city.countrycode = country.code where country.continent = 'Europe' and country.name not in ( select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.isofficial = 'T' and countrylanguage.language = 'English' )

Question: What are the names of cities in Europe for which English is not the official language?
SQL: select distinct city.name from country join city on city.countrycode = country.code where country.continent = 'Europe' and country.name not in ( select country.name from country join countrylanguage on country.code = countrylanguage.countrycode where countrylanguage.isofficial = 'T' and countrylanguage.language = 'English' )

Question: Which unique cities are in Asian countries where Chinese is the official language ?
SQL: select distinct city.name from country join countrylanguage on country.code = countrylanguage.countrycode join city on country.code = city.countrycode where countrylanguage.isofficial = 't' and countrylanguage.language = 'chinese' and country.continent = 'asia'

Question: Return the different names of cities that are in Asia and for which Chinese is the official language.
SQL: select distinct city.name from country join countrylanguage on country.code = countrylanguage.countrycode join city on country.code = city.countrycode where countrylanguage.isofficial = 'T' and countrylanguage.language = 'Chinese' and country.continent = 'Asia'

Question: What are the name, independence year, and surface area of the country with the smallest population?
SQL: select name , surfacearea , indepyear from country order by population asc limit 1

Question: Give the name, year of independence, and surface area of the country that has the lowest population.
SQL: select name , surfacearea , indepyear from country order by population asc limit 1

Question: What are the population, name and leader of the country with the largest area?
SQL: select name , population , headofstate from country order by surfacearea desc limit 1

Question: Give the name, population, and head of state for the country that has the largest area.
SQL: select name , population , headofstate from country order by surfacearea desc limit 1

Question: Return the country name and the numbers of languages spoken for each country that speaks at least 3 languages.
SQL: select count ( countrylanguage.language ) , country.name from country join countrylanguage on country.code = countrylanguage.countrycode group by country.name having count ( * ) > 2

Question: What are the names of countries that speak more than 2 languages, as well as how many languages they speak?
SQL: select count ( countrylanguage.language ) , country.name from country join countrylanguage on country.code = countrylanguage.countrycode group by country.name having count ( * ) > 2

Question: Find the number of cities in each district whose population is greater than the average population of cities?
SQL: select count ( * ) , district from city where population > ( select avg ( population ) from city ) group by district

Question: How many cities in each district have a population that is above the average population across all cities?
SQL: select count ( * ) , district from city where population > ( select avg ( population ) from city ) group by district

Question: Find the government form name and total population for each government form whose average life expectancy is longer than 72.
SQL: select sum ( population ) , governmentform from country group by governmentform having avg ( lifeexpectancy ) > 72

Question: What are the different government forms and what is the total population of each for government forms that have an average life expectancy greater than 72?
SQL: select sum ( population ) , governmentform from country group by governmentform having avg ( lifeexpectancy ) > 72

Question: Find the average life expectancy and total population for each continent where the average life expectancy is shorter than 72?
SQL: select sum ( population ) , avg ( lifeexpectancy ) , continent from country group by continent having avg ( lifeexpectancy ) < 72

Question: What are the different continents and the total popuation and average life expectancy corresponding to each, for continents that have an average life expectancy less than 72?
SQL: select sum ( population ) , avg ( lifeexpectancy ) , continent from country group by continent having avg ( lifeexpectancy ) < 72

Question: What are the names and areas of countries with the top 5 largest area?
SQL: select name , surfacearea from country order by surfacearea desc limit 5

Question: Return the names and surface areas of the 5 largest countries.
SQL: select name , surfacearea from country order by surfacearea desc limit 5

Question: What are names of countries with the top 3 largest population?
SQL: select name from country order by population desc limit 3

Question: Return the names of the 3 most populated countries.
SQL: select name from country order by population desc limit 3

Question: What are the names of the nations with the 3 lowest populations?
SQL: select name from country order by population asc limit 3

Question: Return the names of the 3 countries with the fewest people.
SQL: select name from country order by population asc limit 3

Question: how many countries are in Asia?
SQL: select count ( * ) from country where continent = 'Asia'

Question: Count the number of countries in Asia.
SQL: select count ( * ) from country where continent = 'Asia'

Question: What are the names of the countries that are in the continent of Europe and have a population of 80000?
SQL: select name from country where continent = 'Europe' and population = '80000'

Question: Give the names of countries that are in Europe and have a population equal to 80000.
SQL: select name from country where continent = 'Europe' and population = '80000'

Question: What is the total population and average area of countries in the continent of North America whose area is bigger than 3000 ?
SQL: select sum ( population ) , avg ( surfacearea ) from country where continent = 'north america' and surfacearea > 3000

Question: Give the total population and average surface area corresponding to countries in North America that have a surface area greater than 3000 .
SQL: select sum ( population ) , avg ( surfacearea ) from country where continent = 'north america' and surfacearea > 3000

Question: What are the cities whose population is between 160000 and 900000?
SQL: select name from city where population between 160000 and 900000

Question: Return the names of cities that have a population between 160000 and 900000 .
SQL: select name from city where population between 160000 and 900000

Question: Which language is spoken by the largest number of countries?
SQL: select language from countrylanguage group by language order by count ( * ) desc limit 1

Question: Give the language that is spoken in the most countries.
SQL: select language from countrylanguage group by language order by count ( * ) desc limit 1

Question: What is the language spoken by the largest percentage of people in each country?
SQL: select language , countrycode , max ( percentage ) from countrylanguage group by countrycode

Question: What are the country codes of the different countries, and what are the languages spoken by the greatest percentage of people for each?
SQL: select language , countrycode , max ( percentage ) from countrylanguage group by countrycode

Question: What is the total number of countries where Spanish is spoken by the largest percentage of people?
SQL: select count ( * ) , max ( percentage ) from countrylanguage where language = 'Spanish' group by countrycode

Question: Count the number of countries for which Spanish is the predominantly spoken language.
SQL: select count ( * ) , max ( percentage ) from countrylanguage where language = 'Spanish' group by countrycode

Question: What are the codes of countries where Spanish is spoken by the largest percentage of people?
SQL: select countrycode , max ( percentage ) from countrylanguage where language = 'Spanish' group by countrycode

Question: Return the codes of countries for which Spanish is the predominantly spoken language.
SQL: select countrycode , max ( percentage ) from countrylanguage where language = 'Spanish' group by countrycode