Return a number truncated to 2 decimal places:
SELECT TRUNCATE(135.375, 2);
Try it Yourself »
The TRUNCATE() function truncates a number to the specified number of decimal places.
Note: See also the FLOOR(), CEIL(), CEILING(), and ROUND() functions.
TRUNCATE(
number,
decimals)
Parameter | Description |
---|---|
number | Required. The number to be truncated |
decimals | Required. The number of decimal places to truncate to |
Works in: | From MySQL 4.0 |
---|
Return a number truncated to 0 decimal places:
SELECT TRUNCATE(345.156, 0);
Try it Yourself »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!