MySQL ROUND() Function
THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL ROUND() Function

❮ MySQL Functions

Example

Return a number rounded to a certain number of decimal places:

SELECT ROUND(135.375, 2);
Try it Yourself »

Definition and Usage

The ROUND() function returns a number rounded to a certain number of decimal places.

Note: See also the FLOOR(), CEIL(), CEILING(), and TRUNCATE() functions.

Syntax

ROUND(number, decimal_places)

Parameter Values

Parameter Description
number Required. The number to round
decimal_places Optional. The number of decimal places to round. If omitted, the ROUND() function will return an integer

Technical Details

Works in: MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

More Examples

Example

Return a number rounded to a certain number of decimal places:

SELECT ROUND(345.156, 0);
Try it Yourself »

Example

Round the Price column (to 1 decimal) in the "Products" table:

SELECT ProductName, Price, ROUND(Price, 1) AS RoundedPrice
FROM Products;
Try it Yourself »

❮ MySQL Functions