Simple SQL joins — HackerRank -Average Population of Each Continent
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.
The CITY and COUNTRY tables are described as follows:
use -0.5 to round to nearest integer.
Round(Avg(city.population) - 0.5, 0) AS p
ON( city.countrycode = country.code )
GROUP BY continent
ORDER BY p;