ROUND Function

Description

The ROUND function returns the specified argument, number_operand, rounded to the number of places after the decimal point specified by the integer. If the integer argument is a negative number, it rounds to a place before the decimal point, that is, at the integer part.

Syntax

ROUND( number_operand, integer )

Example

--it rounds a number to one decimal point when the second argument is omitted

SELECT ROUND(34567.34567), ROUND(-34567.34567);

  round(34567.34567, 0)   round(-34567.34567, 0)

============================================

  34567.00000           -34567.00000

 

 

--it rounds a number to three decimal point

SELECT ROUND(34567.34567, 3), ROUND(-34567.34567, 3)  FROM db_root;

 round(34567.34567, 3)   round(-34567.34567, 3)

============================================

  34567.34600           -34567.34600

 

--it rounds a number three digit to the left of the decimal point

SELECT ROUND(34567.34567, -3), ROUND(-34567.34567, -3);

 round(34567.34567, -3)   round(-34567.34567, -3)

============================================

  35000.00000           -35000.00000