cs

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.

Input Format

The CITY and COUNTRY tables are described as follows:

 

 

[My Answer]

SELECT SUM(A.POPULATION) 
FROM CITY A
inner join
COUNTRY B
ON A.COUNTRYCODE = B.CODE 
AND B.CONTINENT = 'Asia';

 

이전 포스트가 weather 문제 다음 문제가 아니였나보다... 그치 갑자기 조인 세개 거는게 이상하긴 했다.. 순서 실수.. 

+ Recent posts