[HackerRank SQL] Average Population of Each Continent

James Jung·2021년 7월 29일
0
post-thumbnail

문제 link
https://www.hackerrank.com/challenges/average-population-of-each-continent/problem

Code link
https://github.com/JamesJung01/Hackerrank_sql/blob/main/01_Easy/Average_Population_of_Each_Continent.sql

Case 1

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

Case 2

SELECT COUNTRY.CONTINENT, TRUNCATE(AVG(CITY.POPULATION),0)
FROM COUNTRY
JOIN CITY
ON COUNTRY.CODE = CITY.COUNTRYCODE
GROUP BY COUNTRY.CONTINENT;

0개의 댓글