ROUND()

Overview

Returns a number rounded to the requested number of decimal places.

USAGE

ROUND(number[, count])

Argument Name

Description

number

The number to be rounded

count

The desired number of decimal places

DETAILS

ROUND() is a mathematical function that rounds off a number at the desired count of decimal places and returns the result.

If is a count is not specified, it defaults to 0. This is equivalent to calling FLOOR().

If the count is negative, the rounding continues past the decimal point. For instance, a count of -2 rounds to the value to hundreds.

If the count is greater than the number of decimal points needed to display the value, it is padded with one or more trailing zeros.

The data type of the result is the same as the data type of the number argument.

A NULL is returned if either argument is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT ROUND(PI());
+-------------+
| ROUND(PI()) |
+-------------+
|           3 |
+-------------+
SELECT ROUND(-1.56);
+--------------+
| ROUND(-1.56) |
+--------------+
|           -2 |
+--------------+
SELECT ROUND(1.123, 5);
+-----------------+
| ROUND(1.123, 5) |
+-----------------+
|         1.12300 |
+-----------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES