bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL TRUNCATE() Function

Concept visual

MySQL TRUNCATE() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Return a number truncated to 2 decimal places:

SELECT TRUNCATE(135.375, 2);

Definition and Usage

The TRUNCATE() function truncates a number to the specified number of decimal places.

Note:

See also the

FLOOR(), CEIL(), CEILING(), and

Round()

functions.

Syntax

Truncate(

number, decimals )

Parameter Values

Parameter

Description number

Required. The number to be truncated decimals Required. The number of decimal places to truncate to

Technical Details

Works in:

From MySQL 4.0

More Examples

Example

Return a number truncated to 0 decimal places:

SELECT TRUNCATE(345.156,
0);

Previous

❮ MySQL Functions

Next

Previous

MySQL TAN() Function

Next

MySQL ADDDATE() Function