Collections:
ROUND() - Rounding to Decimal Place
How to round a value to a given decimal place using the ROUND() function?
✍: FYIcenter.com
ROUND(X, D) is a MySQL built-in function that
rounds X to decimal place of D.
For example:
SELECT ROUND(-1.58), ROUND(23.298, 1), ROUND(23.298, -1); -- +--------------+------------------+-------------------+ -- | ROUND(-1.58) | ROUND(23.298, 1) | ROUND(23.298, -1) | -- +--------------+------------------+-------------------+ -- | -2 | 23.3 | 20 | -- +--------------+------------------+-------------------+
Reference information of the ROUND() function:
ROUND(X, D): val Rounds the argument X to D decimal places. D can be negative to cause D digits left of the decimal point of the value X to become zero. Arguments, return value and availability: X: Required. The value to be rounded. D: Optional. Default is 0. The decimal place to round to. val: Return value. The rounded value. Available since MySQL 4.0.
Related MySQL functions:
⇐ RAND() - Random Value Generator
2023-11-15, 814🔥, 0💬
Popular Posts:
Where to find SQL Server database server tutorials? Here is a collection of tutorials, tips and FAQs...
How to put statements into a statement block in SQL Server Transact-SQL? You can put statements into...
What Are Date and Time Functions in MySQL? MySQL offers a number of functions for date and time valu...
How To Use SQL*Plus Built-in Timers in Oracle? If you don't have a stopwatch/timer and want to measu...
How To Select All Columns of All Rows from a Table with a SELECT statement in SQL Server? The simple...