TRUNCATE(X,D) returns the number X, truncated to D decimal places. : TRUNCATE : Math Numeric Functions MySQL TUTORIALS


MySQL TUTORIALS » Math Numeric Functions » TRUNCATE »

 

TRUNCATE(X,D) returns the number X, truncated to D decimal places.


If D is 0, the result has no decimal point or fractional part.

D can be negative to cause D digits left of the decimal point of the value X to become zero.

mysql>
mysql> SELECT TRUNCATE(1.223,1);
+-------------------+
| TRUNCATE(1.223,1|
+-------------------+
|               1.2 |
+-------------------+
row in set (0.00 sec)

mysql>
mysql> SELECT TRUNCATE(1.999,1);
+-------------------+
| TRUNCATE(1.999,1|
+-------------------+
|               1.9 |
+-------------------+
row in set (0.00 sec)

mysql>



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Math Numeric Functions
» TRUNCATE