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

ROUND

Example

Round the number to two decimal places.

SELECT ROUND(235.4152AS RoundValue;

Definition and Usage

The ROUND() function adjusts a number to a specified decimal precision.

Tip: Explore the FLOOR() and CEILING() functions for floor and ceiling rounding operations.

Syntax

ROUND(numberdecimalsoperation)

Parameter Values

Parameter

Description

number

Required: The numerical value that needs to be rounded.

decimals

Required: The number of decimal places to which the number should be rounded.

operation

Optional: If set to 0, the function rounds the result to the specified number of decimal places. If set to a non-zero value, it truncates the result to that number of decimal places. The default value is 0.

Technical Details

Works in:

SQL Server (beginning from 2008), Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse

More Examples

Example

Round the number to 2 decimal places, and optionally utilize the operation parameter.

SELECT ROUND(235.41521AS RoundValue;

Example

Round the number to the nearest whole number (integer).

SELECT ROUND(235.415, –1AS RoundValue;