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 exercício faz parte do curso
Improving Query Performance in PostgreSQL
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
SELECT country
, region
, MAX(population) - MIN(population) as population_change
FROM country_pop
GROUP BY ___, ___;