Problem
Query the average population for all cities in CITY, rounded down to the nearest integer.
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 average population ==> SELECT AVG(POPULATION)
- round down to the nearest integer ==> SELECT ROUND(AVG(POPULATION))
- in CITY table ==> FROM CITY
Solution
|
|
Link
Average Population
(中文版) SQL 笔记: Hackerrank Average Population
近期评论