SQL 문제풀이

[해커랭크 SQL] Basic Join - Population Census

냄비짱 2023. 8. 22. 23:47
728x90

❓ Question
https://www.hackerrank.com/challenges/asian-population

 

Population Census | HackerRank

Query the sum of the populations of all cities on the continent 'Asia'.

www.hackerrank.com

 

 

❗ Answer

SELECT SUM(city.population)
    FROM city
    INNER JOIN country
            ON city.countrycode = country.code
    WHERE country.continent = 'ASIA';

📌 Discussion

  • INNER JOIN 후 조건을 걸어서 모든 인구를 합해주었다.