Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

ROUND

Example

Round the number to two decimal places.

SELECT ROUND(135.3752);

Definition and Usage

The ROUND() function adjusts a number to a specific number of decimal places.

Note: Also consider the functionalities of FLOOR()CEIL()CEILING(), and TRUNCATE() functions.

Syntax

ROUND(numberdecimals)

Parameter Values

Parameter

Description

number

Necessary: The numerical value to be rounded

decimals

If included, it specifies the number of decimal places to which the number should be rounded; if excluded, it returns the integer value (no decimal places).

Technical Details

Works in:

 From MySQL version 4.0

More Examples

Example

Round the number to the nearest integer.

SELECT ROUND(345.1560);

Example

Round the values in the “Price” column (to one decimal place) within the “Products” table.

SELECT ProductName, Price, ROUND(Price, 1AS RoundedPrice
FROM Products;