Aggregating and sorting populations
You are interested in planning your next vacation. You think it would be fun to visit a country that has changed a lot in recent years. You figure one way to look at change is to look at a change in population. So you focus on countries with big changes in population over the past 25 years.
You have annual population data from the World Bank covering each year from 1990 to 2017. Find the countries with the biggest population changes. Check your query plan to see how the aggregations impact the plan.
Este ejercicio forma parte del curso
Improving Query Performance in PostgreSQL
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
SELECT country
, region
, MAX(population) - MIN(population) as population_change
FROM country_pop
GROUP BY ___, ___;