Reputation: 11
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.
Upvotes: 1
Views: 660
Reputation: 7503
Try the following
select
c.continent,
floor(avg(ci.population))
from country c
join city ci
on c.Code = ci.countrycode
group by
c.continent;
Upvotes: 1