Truncating numbers
Since rounding can sometimes be misleading, i.e., $16.8 becomes $17 while $16.4 remains $16, you may want to truncate the values after the decimal instead of rounding them. When you truncate the numbers, both $16.8 and $16.4 remain $16. In this exercise, you will do just that, truncate the Cost column to a whole number.
Questo esercizio fa parte del corso
Intermediate SQL Server
Istruzioni dell'esercizio
Write a SQL query to truncate the values in the Cost column to the nearest whole number.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
-- Truncate cost to whole number
SELECT Cost,
___ AS TruncateCost
FROM Shipments