TRUNCATE()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns a number truncated to the requested number of decimal places.
USAGE
TRUNCATE(number, count)
Argument Name | Description |
---|---|
| The numeric to modify |
| The number of digits desired after the decimal point |
DETAILS
TRUNCATE()
is a mathematical function that returns the number
truncated to count
decimal places.
A NULL
is returned if either argument is NULL
or the requested number of digits is not in the range 0-6.
EXAMPLES
SELECT TRUNCATE(1.555, 0), TRUNCATE(-1.555, 1);
+--------------------+---------------------+
| TRUNCATE(1.555, 0) | TRUNCATE(-1.555, 1) |
+--------------------+---------------------+
| 1 | -1.5 |
+--------------------+---------------------+