cs

https://www.hackerrank.com/challenges/average-population-of-each-continent/problem?isFullScreen=true&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen 

 

Average Population of Each Continent | HackerRank

Query the names of all continents and their respective city populations, rounded down to the nearest integer.

www.hackerrank.com

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:

 

 

[My Answer]

SELECT B.CONTINENT, Floor(avg(A.POPULATION))
FROM CITY A
INNER JOIN
COUNTRY B
ON A.COUNTRYCODE = B.CODE
GROUP BY B.CONTINENT

 

'Code Problems > SQL_ HackerRank' 카테고리의 다른 글

[Hacker Rank] Symmetric Pairs  (0) 2022.01.24
[Hacker Rank] Placement  (0) 2022.01.24
[HackerRank] African Cities  (0) 2022.01.03
[HackerRank] Population Census  (0) 2021.12.31
[HackerRank] Placement  (0) 2021.12.30

+ Recent posts