Count and count distinct
By pure numbers, the greater a country's population, the greater the pool of athletes and thus Olympians. You decide to look at Olympic medals based purely on population, or volume of available athletes.
The World Bank data shows that in 2016, the countries with the highest populations were China (1,378,665,000), India (1,324,171,354), and the United States of America (323,405,935).
Now you will look at the Olympic athletes' data from the 2016 Summer Olympics to see if China, India, and the USA did indeed win the most medals.
Diese Übung ist Teil des Kurses
Improving Query Performance in PostgreSQL
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
SELECT ___
, ___(___) as medals_count
FROM athletes_recent
WHERE medal IS NOT NULL
AND year = 2016
___ ___
ORDER BY medals_count DESC;