Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
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);