1. Learn
  2. /
  3. Courses
  4. /
  5. Improving Query Performance in PostgreSQL

Exercise

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.

Instructions 1/2

undefined XP
  • 1

    Count the number of athlete_id by country_code.

  • 2

    Modify the query to count the unique athletes.