Average Population of Each Continent

Sort by

recency

|

1781 Discussions

|

  • + 0 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

  • + 0 comments

    select co.continent, floor(avg(c.population)) from city c join country co on c.countrycode = co.code group by co.continent

  • + 0 comments

    SELECT CO.Continent, AVG(CI.Population) FROM CITY CI INNER JOIN COUNTRY CO ON CI.CountryCode = CO.Code GROUP BY CO.Continent;