Truncate
trunc()을 사용해 Fortune 500 기업의 속성 분포를 살펴보세요.
trunc()은 낮은 자리수를 0으로 바꿔 숫자를 잘라낸다는 점을 기억하세요:
trunc(value_to_truncate, places_to_truncate)
places_to_truncate가 음수면 소수점 왼쪽 자리에서 대체할 자릿수를, 양수면 소수점 오른쪽에서 유지할 자릿수를 의미합니다.
이 연습은 강의의 일부입니다
SQL로 하는 탐색적 데이터 분석
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
-- Truncate employees
SELECT ___(___, ___) AS employee_bin,
-- Count number of companies with each truncated value
___
FROM fortune500
-- Use alias to group
GROUP BY ___
-- Use alias to order
ORDER BY ___;