SQL 문제풀이

[해커랭크 SQL] Aggregation - Revising Aggregations - The Sum Function

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

❓ Question
https://www.hackerrank.com/challenges/revising-aggregations-sum

 

Revising Aggregations - The Sum Function | HackerRank

Query the total population of all cities for in the District of California.

www.hackerrank.com

 

❗ Answer

SELECT SUM(population)
    FROM city
    WHERE district='California';

📌 Discussion

  • where로 조건에 맞는 레코드 불러온 후 sum으로 집계