-
HackerRank - Average Population of Each ContinentDataBase/Hackers Rank 2024. 10. 7. 23:05반응형
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 and COUNTRY tables are described as follows:
Answer
SELECT country.continent , FLOOR(AVG(city.population)) FROM city INNER JOIN country ON city.countrycode = country.code GROUP BY country.continent
Result
Asia 693038 Europe 175138 Oceania 109189 South America 147435 Africa 274439
반응형'DataBase > Hackers Rank' 카테고리의 다른 글
HackerRank - Population Census (1) 2024.10.07 African Cities - INNER JOIN (0) 2024.10.07 HackerRank - Type of Triangle (0) 2024.09.30 HackersRank - Population Density Difference 문제 (0) 2024.08.02 HackersRank - Average Population 문제 (0) 2024.08.01