혜온의 이것저것

[HackerRank] Population Census (MySQL) 본문

Data Analysis/SQL

[HackerRank] Population Census (MySQL)

혜온 :) 2022. 8. 29. 15:11

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: 

 

풀이
select sum(c1.population)
from city c1, country c2
where c1.countrycode = c2.code and c2.continent='Asia'
Comments