bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL ROUND() Function

Concept visual

MySQL ROUND() Function

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

Start at both ends

Example

Round the number to 2 decimal places:

SELECT ROUND(135.375, 2);

Definition and Usage

The ROUND() function rounds a number to a specified number of decimal places.

Note:

See also the

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

Truncate()

functions.

Syntax

Round(

number, decimals )

Parameter Values

Parameter

Description number

Required. The number to be rounded decimals Optional. The number of decimal places to round number to. If omitted, it returns the integer (no decimals)

Technical Details

Works in:

From MySQL 4.0

More Examples

Example

Round the number to 0 decimal places:

SELECT ROUND(345.156,
0);

Example

Round the Price column (to 1 decimal) in the "Products" table: SELECT ProductName, Price, ROUND(Price, 1) AS RoundedPrice

FROM Products;

Previous

❮ MySQL Functions

Next

Previous

MySQL RAND() Function

Next

MySQL SIGN() Function