Truncate
Use trunc() to examine the distributions of attributes of the Fortune 500 companies.
Remember that trunc() truncates numbers by replacing lower place value digits with zeros:
trunc(value_to_truncate, places_to_truncate)
Negative values for places_to_truncate indicate digits to the left of the decimal to replace, while positive values indicate digits to the right of the decimal to keep.
Latihan ini adalah bagian dari kursus
Exploratory Data Analysis in SQL
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
-- 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 ___;