Home >Database >Mysql Tutorial >What is the use of MySQL TRUNCATE() function?
MySQL TRUNCATE() The function returns the value of X truncated to D decimal places. If D is 0, remove the decimal point. If D is negative, the integer part of the D values is truncated. The syntax is as follows -
TRUNCATE(X, D)
Here
In the example below, it will truncate the given number to up to 2 decimal places.
mysql> Select TRUNCATE(10.7336432,2); +-----------------------+ | TRUNCATE(10.736432,2) | +-----------------------+ | 10.73 | +-----------------------+ 1 row in set (0.00 sec)
The above is the detailed content of What is the use of MySQL TRUNCATE() function?. For more information, please follow other related articles on the PHP Chinese website!