Jump to: navigation, search

Mysql TRUNCATE

From w3cyberlearnings

Contents

MySQL TRUNCATE Function

This function truncated X to D decimal places and return the result. If D is 0, it returns 1.

Syntax TRUNCATE

TRUNCATE();

Example 1

mysql> SELECT TRUNCATE(20.4333,3);
+---------------------+
| TRUNCATE(20.4333,3) |
+---------------------+
|              20.433 |
+---------------------+
1 row in set (0.00 sec)

Example 2

mysql> SELECT TRUNCATE(20.4333,2);
+---------------------+
| TRUNCATE(20.4333,2) |
+---------------------+
|               20.43 |
+---------------------+
1 row in set (0.00 sec)

Related Links


Navigation
Web
SQL
MISC
References