SQL 문제풀이

[해커랭크 SQL] Aggregation - Japan Population

냄비짱 2023. 8. 23. 00:23
728x90

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

 

Japan Population | HackerRank

Query to the sum of the populations of all Japanese cities in CITY.

www.hackerrank.com

❗ Answer

SELECT SUM(population)
    FROM city
    WHERE countrycode = 'JPN';

📌 Discussion

  • where 절에서 조건에 맞는 레코드만 추출 후 sum 집계