-
[HackerRank/Aggregation] Revising Aggregations - Average Population공부/PS ( SQL) 2022. 5. 18. 02:16
https://www.hackerrank.com/challenges/average-population/problem
Average Population | HackerRank
Query the average population of all cities, rounded down to the nearest integer.
www.hackerrank.com
문제
풀이
SELECT ROUND(AVG(POPULATION)) FROM CITY
- 반올림 (ROUND)
사용법: ROUND(숫자, 반올림할 자릿수) - 제거 (TRUNCATE)
사용법: TRUNCATE(숫자, 남길 자릿수(소수n째 자리))
무조건 버림할 자릿수를 입력해야함 - 올림 (CEIL)
사용법: CEIL(숫자) - 버림 (FLOOR)
사용법: FLOOR(숫자)
'공부 > PS ( SQL)' 카테고리의 다른 글
[MYSQL] JOIN 참고 (0) 2022.05.18 [HackerRank/Basic Join] Population Census (0) 2022.05.18 [HackerRank/Aggregation] Revising Aggregations - Averages (0) 2022.05.18 [HackerRank/Aggregation] Revising Aggregations - The Count Function (0) 2022.05.17 [HackerRank/Advanced Select] The PADS (0) 2022.05.16 - 반올림 (ROUND)