본문 바로가기

Language/SQL

[HackerRank][SQL][JOIN] Basic Join, Population Census - 컴도리돌이

728x90
 

Population Census | HackerRank

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

www.hackerrank.com


Problem

 

 

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

-> 아시아에 있는 모든 도시의 인구 수의 합을 출력하시오.


Answer

select sum(a.population)
from city a inner join country b on a.countrycode = b.code
where b.continent = "Asia"