Average Population of Each Continent

AGGREGATION

Question Link

Given the CITY and COUNTRY tables, query the names of all the continents (COUNTRY.Continent) and their respective average city populations (CITY.Population) rounded down to the nearest integer.

Note: CITY.CountryCode and COUNTRY.Code are matching key columns.

Input Format

The CITY table is described as follows:

The COUNTRY table IS described as follows:

SELECT 
    cy.continent,
    FLOOR(AVG(c.population))
FROM City c
JOIN Country cy
ON c.countrycode = cy.code
GROUP BY cy.continent

Last updated