©SQL :: Manager
HomeProgram InformationTechnical detailsFree downloadDonate for a cup of coffee
myway SQL Manager for MySQL and MariaDB, Download on Uptodown
SQL functionMySQLMariaDB

The ROUND SQL Function in MySQL and MariaDB - Round to decimals

ROUNDSyntax:ROUND(Number [, Decimals])
Return value:DECIMAL
Function type:Numeric function
Function Description

The ROUND() function rounds "Number" to "Decimals". Decimal places defaults to 0 if not specified.

Decimal places can be negative so that the digits to the left of the decimal point of "Number" become zero.

ROUND() returns NULL if the value of "Number" is NULL.

Example 1: Rounding without decimals.

 1
 2
 3
 4

select round(45.67) as result;


result
decimal(4)
46

Example 2: Rounding with decimals.

 1
 2
 3
 4

select round(45.67,1) as result;


result
decimal(6)
45.7

Example 3: Rounding with negative decimals.

 1
 2
 3
 4

select round(45.67,-1) as result;


result
decimal(4)
50

Example 4: Rounding with negative decimals.

 1
 2
 3
 4

select round(45.67,-2) as result;


result
decimal(4)
0

Example 5: Rounding with negative decimals.

 1
 2
 3
 4

select round(145.67,-2) as result;


result
decimal(5)
100
The examples were created with the MyWAY SQL manager: Download

How to use the ROUND() function in MySQL and MariaDB databases

The ROUND() function in MySQL and MariaDB can be useful in various applications where numeric Values ​​must be rounded to a specific number of decimal places:

When users are presented with numeric data, the values ​​can be rounded to a specified number of decimal places for readability. The ROUND() function helps to format the values ​​before displaying them.

When calculating average values ​​of numeric data, the result can be rounded to a specified number of decimal places. This ensures that the average is consistent and easy to interpret.

In financial applications, it is often necessary to round monetary values ​​to a specified number of decimal places to ensure accuracy and to comply with certain regulations or conventions.

When reporting or performing aggregations on numeric data, the resulting values ​​may need to be rounded to the desired precision.

In data analysis tasks, rounding values ​​can be useful to simplify data or reduce the level of detail. It can also be useful when comparing values ​​or grouping data based on rounded values.
REVERSERIGHTRLIKEROUNDROW_COUNTRPADRPAD_ORACLE

Further MySQL und MariaDB SQL Numeric functions

BIT_COUNTBIT_COUNT(Integer)
More about BIT_COUNT Function

CEILCEIL(Number)
More about CEIL Function

CEILINGCEILING(Number)
More about CEILING Function

CRC32CRC32(String)
More about CRC32 Function

CRC32CCRC32C([Parameter], String)

FLOORFLOOR(Number)
More about FLOOR Function

SIGNSIGN(Number)
More about SIGN Function

ABSABS(Number)
More about ABS Function

ACOSACOS(Number)
More about ACOS Function

ASINASIN(Number)
More about ASIN Function

ATANATAN(Number [, Number2])
More about ATAN Function

ATAN2ATAN2(Number [, Number2])
More about ATAN2 Function

COSCOS(Number)
More about COS Function

COTCOT(Number)
More about COT Function

DEGREESDEGREES(Number)
More about DEGREES Function

EXPEXP(Number)
More about EXP Function

LNLN(Number)
More about LN Function

LOGLOG([Base], Number)
More about LOG Function

LOG10LOG10(Number)
More about LOG10 Function

LOG2LOG2(Number)
More about LOG2 Function

MODMOD(Number, Divider)
More about MOD Function

POWPOW(Number, Exponent)
More about POW Function

POWERPOWER(Number, Exponent)
More about POWER Function

PIPI()
More about PI Function

RADIANSRADIANS(Number)
More about RADIANS Function

RANDRAND([Number])
More about RAND Function

SINSIN(Number)
More about SIN Function

SQRTSQRT(Number)
More about SQRT Function

TANTAN(Number)
More about TAN Function

TRUNCATETRUNCATE(Number, Decimals)
More about TRUNCATE Function

Numeric functionsString functionsRegular ExpressionsDate and Time functions
Comparison functionsEncryption & CompressionConversion functionsNULL functions
Aggregate functionsWindow functionsJSON functionsGeometric functions
Sequence functionsInformation functionsDynamic ColumnsMiscellaneous functions
More information about the ROUND SQL function: mysql.com and mariadb.com and w3schools.com
Updated: 2023-09-24ImprintContactTerms & conditionsPrivacy & CookiesUpdatesSitemapFacebookLinkedinTwitterStatistics©2020-2024 Heino Cunze-Fischer