Average Population of Each Continent Hacker Rank Solution

Hello coders, In this post, you will learn how to solve the Average Population of Each Continent Hacker Rank Solution. This problem is a part of the SQL Hacker Rank series.

Average Population of Each Continent Hacker Rank Solution
Averages Population of Each Continent Hacker Rank Solution

Average Population of Each Continent Hacker Rank Solution

Problem

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:

 Average Population of Each Continent Hacker Rank Solution

Average Population of Each Continent Hacker Rank Solution

Average Population of Each Continent Hacker Rank Solution

SELECT o.CONTINENT, FLOOR(AVG(i.POPULATION))
FROM CITY AS i JOIN COUNTRY AS o ON i.COUNTRYCODE=o.CODE GROUP BY o.CONTINENT;

Disclaimer: The above Problem (Average Population of Each Continent) generated by Hackerrank but the Solution is Provided by Chase2Learn. This tutorial is only for Educational and Learning purposes.

Sharing Is Caring