IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Exploratory Data Analysis in SQL

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

-- 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 ___;
Modifica ed esegui il codice