문제>
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.
즉, COUNTRY.continent = ''Asia 인 CITY.population 의 합을 조회해라.
COUNTRY.Code 와 CITY.CountryCode 키 매칭
SELECT SUM(B.population)
FROM COUNTRY A
INNER JOIN CITY B ON A.Code = B.CountryCode
WHERE A.CONTINENT = 'Asia'
'개인공부 > SQL' 카테고리의 다른 글
[SQL]리트코드 181. Employees Earning More Than Their Managers 문제 풀이 (0) | 2023.04.22 |
---|---|
[SQL]리트코드 183. Customers Who Never Order 문제 풀이 (0) | 2023.04.22 |
[SQL]해커랭크 Average Population of Each Continent 문제 풀이 (0) | 2023.04.22 |
[SQL]해커랭크 African Cities 문제 풀이 (0) | 2023.04.22 |
[SQL]자주쓰는 SQL 정리 (1) | 2023.04.19 |