> 개발-IT-인터넷/> SQL

[해커랭크(HackerRank) SQL 풀이] - Revising Aggregations - The Sum Function

jini:) 2024. 1. 5. 10:02
728x90
반응형
해커 랭크 - https://www.hackerrank.com/
Prepare > SQL > Aggregation > Revising Aggregations - The Count Function

 

 

HackerRank - Online Coding Tests and Technical Interviews

HackerRank is the market-leading coding test and interview solution for hiring developers. Start hiring at the pace of innovation!

www.hackerrank.com

 

 

CITY 테이블에서 구역이 California인 모든 도시의 총 인구를 조회하는 쿼리를 작성하세요.

 

Input Format

[출처] https://www.hackerrank.com/challenges/revising-aggregations-sum/problem

 

반응형

 

MySQL
SELECT  SUM(POPULATION)
FROM    CITY
WHERE   DISTRICT = 'California';

 

Oracle
SELECT  SUM(POPULATION)
FROM    CITY
WHERE   DISTRICT = 'California';

 

MS SQL Server
SELECT  SUM(POPULATION)
FROM    CITY
WHERE   DISTRICT = 'California';

 

 


  • SUM
    • 주어진 열의 숫자 값들의 합계를 계산하는데 사용.
    • 일반적으로 숫자형 데이터를 가진 열에 대해 사용.
    • 해당 열의 모든 값을 더하여 총합을 반환.

 

 

개인 공부를 위한 포스팅입니다.
모든 번역, 코드는 완벽하지 않을 수 있습니다.

 

 

 

728x90
반응형