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, 1345🔥, 0💬
Popular Posts:
How To Get the Definition of a View Out of the SQL Server in SQL Server? If you want get the definit...
How To Update Multiple Rows with One UPDATE Statement in SQL Server? If the WHERE clause in an UPDAT...
Where to find answers to frequently asked questions on PHP Connections and Query Execution for MySQL...
What Happens to Your Transactions When ERROR 1205 Occurred in MySQL? If your transaction receives th...
Where to find reference information and tutorials on MySQL database functions? I want to know how to...