융무의 기술블로그
article thumbnail

https://www.hackerrank.com/challenges/asian-population/problem

 

Asian Population | 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:

  • join two tables on countrycode ==> FROM CITY AS i JOIN COUNTRY AS o ON i.COUNTRYCODE=o.CODE
  • query sum of populations of cities ==> SELECT SUM(i.POPULATION)
  • where Continent is ‘Asia’ ==> WHERE o.CONTINENT=‘Asia’
SELECT SUM(C.POPULATION)
FROM CITY AS C
JOIN COUNTRY AS O ON C.COUNTRYCODE = O.CODE
WHERE O.CONTINENT = 'Asia';
profile

융무의 기술블로그

@융무

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!