SELECT CONTINENT, AVG(POPULATION) AS POPULATION
  FROM (
        SELECT COUNTRY.CONTINENT AS CONTINENT, CITY.POPULATION AS POPULATION
          FROM COUNTRY
          LEFT JOIN CITY
            ON COUNTRY.CODE = CITY.COUNTRYCODE
         WHERE CITY.POPULATION IS NOT NULL
        ) A
 GROUP BY CONTINENT
;
