Average Population of Each Continent

  • [deleted]
    + 4 comments

    I'm on the same page! Here's the query

    select country.continent, city.name, round(avg(city.population)) from country join city on city.countrycode = country.code GROUP BY country.continent, city.name;

    I also used

    select distinct country.continent, city.name, round(avg(city.population)) from country join city on city.countrycode = country.code GROUP BY country.continent, city.name;

    and even

    select distinct country.continent, city.name, round(avg(city.population)) from country join city on city.countrycode = country.code where city.name is not null GROUP BY country.continent, city.name;

    What do you suggest?