공부/PS ( SQL)
[HackerRank/Basic Join] Average Population of Each Continent
happyst
2022. 5. 18. 23:11
https://www.hackerrank.com/challenges/average-population-of-each-continent/problem
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
문제
풀이
SELECT COUNTRY.CONTINENT, TRUNCATE(AVG(CITY.POPULATION),0) FROM COUNTRY
JOIN CITY
ON CITY.COUNTRYCODE = COUNTRY.CODE
GROUP BY COUNTRY.CONTINENT