728x90
반응형
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:
![](https://blog.kakaocdn.net/dn/D4lzj/btsrBPk9J9T/hRbaGwPrzRJ91scDK8aRPk/img.jpg)
![](https://blog.kakaocdn.net/dn/dWqoNj/btsrEqj7K25/yOk5TLiCZ9NXYzVHIvLKkk/img.jpg)
Code
SELECT SUM(CITY.POPULATION)
FROM CITY
JOIN COUNTRY ON CITY.COUNTRYCODE = COUNTRY.CODE
WHERE COUNTRY.CONTINENT = 'ASIA'
728x90
반응형
'SQL > MySQL' 카테고리의 다른 글
[MySQL/HackerRank] Top Earners (0) | 2023.08.25 |
---|---|
[MySQL/HackerRank] African Cities (0) | 2023.08.21 |
[MySQL/HackerRank] Average Population of Each Continent (0) | 2023.08.21 |
[MySQL/HackerRank] The Blunder (0) | 2023.08.21 |
[MySQL/HackerRank] Population Density Difference (0) | 2023.08.21 |