Average Population of Each Continent

Sort by

recency

|

1783 Discussions

|

  • + 0 comments

    SELECT CO.Continent, FLOOR(AVG(C.Population)) FROM Country CO JOIN City C ON C.CountryCode = CO.Code GROUP BY CO.Continent;

  • + 0 comments

    This problem statement has some issues. Admin should look into it. Also some continenet can have 0 populations considering if city table doesn't have any data for a continent.

  • + 2 comments

    Not sure why, when the question asks to round off to the nearest integer, it doesn't accept the solution when ROUND() is used. Needed to do FLOOR(). Question needs to be changed?

  • + 0 comments

    SELECT co.continent , floor(avg(ci.population)) FROM city ci INNER JOIN country co ON ci.COUNTRYCODE = co.CODE GROUP BY co.CONTINENT;

  • + 0 comments

    to those this query is not working with floor() function please check which join you are using if you are using left join it'll not work... Here Inner join will be used because you want population avg for continents and it should match in both tables-[ continents in country table must have population of cities in city table, if no population it'll be NULL]... Hope it will help