
Problem
Query the total population of all cities in CITY where District is California.
Input Format
The CITY table is described as follows:
| Field | Type |
|---|---|
| ID | NUMBER |
| NAME | VARCHAR2(17) |
| COUNTRYCODE | VARCHAR2(3) |
| DISTRICT | VARCHAR2(20) |
| POPULATION | NUMBER |
Analysis
- query total population ==> SELECT SUM(POPULATION)
- in CITY table ==> FROM CITY
- District is California ==> WHERE DISTRICT = ‘California’
Solution
|
|
Link
Revising Aggregations - The Sum Function
(中文版) SQL 笔记: Hackerrank Revising Aggregations - The Sum Function




近期评论