Home  >  Article  >  Database  >  What does round mean in mysql?

What does round mean in mysql?

下次还敢
下次还敢Original
2024-04-29 04:57:12933browse

ROUND function is used to round numbers to the specified number of digits: Syntax: ROUND(number, decimals); when decimals is a positive value, round to the specified number of decimal places; when decimals is a negative value, round to the specified integer bits before; when decimals is 0, round to the nearest integer; when number or decimals is NULL, return NULL.

What does round mean in mysql?

ROUND Function

#ROUND function is used to round a number to a specified number of digits.

Syntax:

<code class="sql">ROUND(number, decimals)</code>

Where:

  • number:The number to be rounded.
  • decimals: Specify the number of decimal places to round to.

Example:

  • ROUND(123.456, 2) = 123.46
  • ROUND(3.14159, 3) = 3.142
  • ROUND(-25.789, 0) = -26

Note:

  • If decimals is positive value is rounded to the specified number of decimal places.
  • If decimals is negative, rounding to the number of integer digits preceding the specified number of digits.
  • If decimals is 0, round to the nearest integer.
  • If number is NULL or decimals is NULL, then NULL is returned.

The above is the detailed content of What does round mean in mysql?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Usage of as in mysqlNext article:Usage of as in mysql