Skip to main content
Version: current [26.x]

Categories: Math

ROUND

Returns the rounded value for the inputted value. If no scale is specified, the closest whole number is returned.

Syntax

ROUND(numeric_expression decimal(0,0), scale int32) → decimal(0,0)

  • numeric_expression: Numeric value to round.
  • scale: The decimal place to round.

Examples

ROUND example
SELECT ROUND(-24.35, -1)
-- -20
ROUND example
SELECT ROUND(24.35, 1)
-- 24.4

ROUND(numeric_expression int32, scale int32) → int32

  • numeric_expression: Numeric value to round.
  • scale: The decimal place to round.

Examples

ROUND example
SELECT ROUND(24, 0)
-- 24
ROUND example
SELECT ROUND(-24, -1)
-- -20

ROUND(numeric_expression int32) → int32

  • numeric_expression: Numeric value to round.

Examples

ROUND example
SELECT ROUND(24)
-- 24

ROUND(numeric_expression double) → double

  • numeric_expression: Numeric value to round.

Examples

ROUND example
SELECT ROUND(24.35)
-- 24

ROUND(numeric_expression decimal(0,0)) → decimal(0,0)

  • numeric_expression: Numeric value to round.

Examples

ROUND example
SELECT ROUND(99.567)
-- 100

ROUND(numeric_expression float) → float

  • numeric_expression: Numeric value to round.

Examples

ROUND example
SELECT ROUND(CAST(24.56 AS FLOAT))
-- 25

ROUND(numeric_expression int64) → int64

  • numeric_expression: Numeric value to round.

Examples

ROUND example
SELECT ROUND(CAST(9223372036854775 AS BIGINT))
-- 9223372036854775

ROUND(numeric_expression int64, scale int32) → int64

  • numeric_expression: Numeric value to round.
  • scale: The decimal place to round.

Examples

ROUND example
SELECT ROUND(CAST(12345 AS BIGINT), -2)
-- 12300

ROUND(numeric_expression double, scale int32) → double

  • numeric_expression: Numeric value to round.
  • scale: The decimal place to round.

Examples

ROUND example
SELECT ROUND(123.456, 2)
-- 123.46

ROUND(numeric_expression float, scale int32) → float

  • numeric_expression: Numeric value to round.
  • scale: The decimal place to round.

Examples

ROUND example
SELECT ROUND(CAST(78.567 AS FLOAT), 1)
-- 78.6