Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

TRUNCATE

Example

Provide a number rounded to two decimal places.

SELECT TRUNCATE(135.3752);

Definition and Usage

The TRUNCATE() function cuts off a number to the designated decimal places.

Note: Refer also to the FLOOR(), CEIL(), CEILING(), and ROUND() functions.

Syntax

TRUNCATE(numberdecimals)

Parameter Values

Parameter

Description

number

Mandatory: The number for truncation

decimals

Mandatory: The number of decimal places for truncation

Technical Details

Works in:

 From MySQL version 4.0

More Examples

Example

Provide a number rounded to zero decimal places.

SELECT TRUNCATE(345.1560);