Beginner

255. TRUNCATE Number

Learn how to remove decimal precision without performing normal rounding.

📘 Lesson 255 of 728 ⏱ 9 min 🎯 Intermediate

Numeric truncation removes digits beyond a specified precision without rounding the value. The exact function name and behavior can vary between database systems.

Sometimes calculations require decimal digits to be removed rather than rounded, especially in controlled business calculations.

Truncate a calculated value to two decimal places.

SQL
SELECT
    TRUNCATE(UnitPrice, 2) AS TruncatedPrice
FROM Products;

Numeric truncation can be used in financial calculations, reporting, pricing logic, and data preparation.

  • Truncation removes precision without normal rounding.
  • The exact function varies by database.
  • It differs from ROUND.
  • It can be useful for controlled calculations.
  • Negative values require careful interpretation.
What is numeric truncation?

Numeric truncation removes digits beyond a specified precision without applying normal rounding.

How is truncation different from ROUND?

ROUND may increase the retained digit based on the next digit, while truncation simply removes digits beyond the selected precision.

Have you finished this lesson?

Introduction to SQL – All Lessons