Prepare > SQL > Aggregation > Average Population
2023. 5. 16. 20:32ㆍHackerRank-My SQL
Average Population | HackerRank
Query the average population of all cities, rounded down to the nearest integer.
www.hackerrank.com
문제
Query the average population for all cities in CITY, rounded down to the nearest integer.
코드
SELECT FLOOR(AVG(POPULATION)) FROM CITY;
- 반올림이랑 내림이랑 다른데...어찌어찌 정답처리가 됐네
두 번째 시도
SELECT ROUND(AVG(POPULATION),0) FROM CITY;
'HackerRank-My SQL' 카테고리의 다른 글
Prepare > SQL > Aggregation > Population Density Difference (0) | 2023.05.16 |
---|---|
Prepare > SQL > Aggregation > Japan Population (0) | 2023.05.16 |
Prepare > SQL > Advanced Select > Occupations (3) | 2023.05.16 |
Prepare > SQL > Advanced Select > The PADS (0) | 2023.05.16 |
Prepare > SQL > Basic Select > Higher Than 75 Marks (0) | 2023.05.15 |