Skip to content
SQLSimplified
numeric

TRUNC()

Truncates a number toward zero, removing digits past a given precision.

Description

TRUNC cuts off digits beyond a specified number of decimal places, moving toward zero (unlike ROUND, it never rounds). TRUNC(3.987, 1) is 3.9, and TRUNC(-3.987, 1) is -3.9. It's ideal when you want to drop precision without rounding up or down.

Syntax

TRUNC(expression)
TRUNC(expression, n)

Parameters

NameDescriptionOptional
expressionA numeric column or expression.No
nDecimal places to keep (default 0).Yes

Return Type

Returns the same numeric type as the input.

Examples

Store (Customers/Orders/Products)

Loading database engine...

Store (Customers/Orders/Products)

Loading database engine...

TRUNC vs ROUND

TRUNC just chops digits; ROUND adjusts the last kept digit. Use TRUNC when you must not round.

Common Mistakes

  • Expecting rounding. TRUNC never rounds — TRUNC(3.9) is 3, not 4.
  • Confusing with FLOOR. TRUNC moves toward zero; FLOOR moves down. TRUNC(-3.9) is -3, FLOOR(-3.9) is -4.
  • Wrong precision sign. A negative n truncates to the left of the decimal.

See also: ROUND, FLOOR, CEIL.

Search

Search lessons, functions, examples, and practice problems