MySQL TRUNCATE() Function
Example
Return a number truncated to a certain number of decimal places:
SELECT TRUNCATE(135.375, 2);
Try it Yourself »
Definition and Usage
The TRUNCATE() function returns a number truncated to a certain number of decimal places.
Note: See also the FLOOR(), CEIL(), CEILING(), and ROUND() functions.
Syntax
TRUNCATE(number, decimal_places)
Parameter Values
Parameter | Description |
---|---|
number | Required. The number to truncate |
decimal_places | Required. The number of decimal places to truncate to. Must be a positive or negative integer |
Technical Details
Works in: | MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23 |
---|
More Examples
Example
Return a number truncated to a certain number of decimal places:
SELECT TRUNCATE(345.156,
0);
Try it Yourself »