HackerRank

[해커랭크 HackerRank] Population Census [MySQL]

치킨먹고싶어요 2022. 5. 26. 11:36

https://www.hackerrank.com/challenges/asian-population/problem?isFullScreen=true 

 

Population Census | HackerRank

Query the sum of the populations of all cities on the continent 'Asia'.

www.hackerrank.com

 

Given the CITY and COUNTRY tables, query the sum of the populations of all cities where the CONTINENT is 'Asia'.

Note: CITY.CountryCode and COUNTRY.Code are matching key columns.

해석:

주어진 CITY와 COUNTRY 테이블에서 COUNTINENT가 Asia인 모든 도시의 총 인구수를 출력하라

SELECT SUM(CITY.POPULATION)
FROM CITY
JOIN COUNTRY ON COUNTRY.Code = CITY.CountryCode
WHERE COUNTRY.CONTINENT = 'Asia'
cs
 

 

JOIN과 WHERE을 활용하는 간단한 문제였습니다