Aan de slagGa gratis aan de slag

South African trends

You decide to zero in on one country to look at country demographic trends over time. Since 1990 (the first year of demographics' data), South Africa's population has increased from 37.5 to 56.7 million people. The GDP per capita has also increased from $6,267 to $13,497.

You want to determine if the number of Olympic athletes from South Africa has increased during this time.

The athletes table is at an athlete-event level grain. You aggregate it to the year-country grain before joining it to the demographics_rank table. Additionally, the demographics_rank table is large, so you want to filter it to only South Africa before joining it to the athletes data.

Deze oefening maakt deel uit van de cursus

Improving Query Performance in PostgreSQL

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

SELECT ___
  , ___
  , ___(___ ___) AS no_athletes
FROM athletes
WHERE country_code = ___
GROUP BY year, season;
Code bewerken en uitvoeren