<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>http://wiki.eijux.com/index.php?action=history&amp;feed=atom&amp;title=MySQL_%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%9A%E6%95%B0%E5%80%BC%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6</id>
	<title>MySQL 函数和运算符：数值函数和运算符 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.eijux.com/index.php?action=history&amp;feed=atom&amp;title=MySQL_%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%9A%E6%95%B0%E5%80%BC%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6"/>
	<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=MySQL_%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%9A%E6%95%B0%E5%80%BC%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6&amp;action=history"/>
	<updated>2026-05-15T13:20:29Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=MySQL_%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%9A%E6%95%B0%E5%80%BC%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6&amp;diff=6525&amp;oldid=prev</id>
		<title>2023年3月31日 (五) 15:09 Eijux</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=MySQL_%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%9A%E6%95%B0%E5%80%BC%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6&amp;diff=6525&amp;oldid=prev"/>
		<updated>2023-03-31T15:09:22Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年3月31日 (五) 23:09的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;第1行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第1行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;MySQL&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[category:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;MySQL文档&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 算术运算符 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 算术运算符 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=MySQL_%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%9A%E6%95%B0%E5%80%BC%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6&amp;diff=2228&amp;oldid=prev</id>
		<title>Eijux：​/* 数学函数 */</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=MySQL_%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%9A%E6%95%B0%E5%80%BC%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6&amp;diff=2228&amp;oldid=prev"/>
		<updated>2021-03-30T01:45:50Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;数学函数&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年3月30日 (二) 09:45的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l29&quot;&gt;第29行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第29行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 数学函数 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 数学函数 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;! Option Name !! Description &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;!! Introduced !! Deprecated&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;! Option Name !! Description  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|-&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| '''ABS()''' || 返回'''绝对值'''&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;| '''ABS()''' || 返回'''绝对值'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=MySQL_%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%9A%E6%95%B0%E5%80%BC%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6&amp;diff=2227&amp;oldid=prev</id>
		<title>Eijux：​建立内容为“category:MySQL  == 算术运算符 == {| class=&quot;wikitable&quot; ! Name !! Description  |- | %, MOD || Modulo operator【取模，即取余数】 |- | * || Multipli…”的新页面</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=MySQL_%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%9A%E6%95%B0%E5%80%BC%E5%87%BD%E6%95%B0%E5%92%8C%E8%BF%90%E7%AE%97%E7%AC%A6&amp;diff=2227&amp;oldid=prev"/>
		<updated>2021-03-30T01:45:34Z</updated>

		<summary type="html">&lt;p&gt;建立内容为“&lt;a href=&quot;/%E5%88%86%E7%B1%BB:MySQL&quot; title=&quot;分类:MySQL&quot;&gt;category:MySQL&lt;/a&gt;  == 算术运算符 == {| class=&amp;quot;wikitable&amp;quot; ! Name !! Description  |- | %, MOD || Modulo operator【取模，即取余数】 |- | * || Multipli…”的新页面&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[category:MySQL]]&lt;br /&gt;
&lt;br /&gt;
== 算术运算符 ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Name !! Description &lt;br /&gt;
|-&lt;br /&gt;
| %, MOD || Modulo operator【取模，即取余数】&lt;br /&gt;
|-&lt;br /&gt;
| * || Multiplication operator&lt;br /&gt;
|-&lt;br /&gt;
| + || Addition operator&lt;br /&gt;
|-&lt;br /&gt;
| - || Minus operator&lt;br /&gt;
|-&lt;br /&gt;
| - || 更改参数的符号【一元减】&lt;br /&gt;
|-&lt;br /&gt;
| / || Division operator&lt;br /&gt;
|-&lt;br /&gt;
| DIV || 整数除法【结果只取整数部分】&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
可以使用通常的算术运算符。根据以下规则确定结果：&lt;br /&gt;
# 对于“+”，“-”和“*”，如果两个操作数均为'''整数'''，则以“'''BIGINT'''”(64 位)精度计算结果。&lt;br /&gt;
# 如果两个操作数都是整数，并且它们中的任何一个都是无符号的，则结果是无符号的整数。对于减法，如果启用了“NO_UNSIGNED_SUBTRACTION” SQL 模式，则即使对任何操作数都是无符号的，结果也是无符号数。&lt;br /&gt;
# 如果“+”，“-”，“*”，“/”，“%”的任何操作数是实数值或字符串值，则'''结果的精度是具有最大精度的操作数的精度'''。&lt;br /&gt;
# 在使用“/”执行的除法中，使用两个精确值操作数时结果的小数位数是'''第一个操作数的小数加“div_precision_increment”(默认为 4)系统变量的值'''。&lt;br /&gt;
#: 例如，表达式“5.05 / 0.014”的结果的小数位数为六位：“360.714286”。&lt;br /&gt;
&lt;br /&gt;
== 数学函数 ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Option Name !! Description !! Introduced !! Deprecated&lt;br /&gt;
|-&lt;br /&gt;
| '''ABS()''' || 返回'''绝对值'''&lt;br /&gt;
|-&lt;br /&gt;
| ACOS() || 返回反余弦&lt;br /&gt;
|-&lt;br /&gt;
| ASIN() || 返回反正弦&lt;br /&gt;
|-&lt;br /&gt;
| ATAN() || 返回反正切&lt;br /&gt;
|-&lt;br /&gt;
| ATAN2(), ATAN() || 返回两个参数的反正切&lt;br /&gt;
|-&lt;br /&gt;
| '''CEIL()''' || 返回'''不小于参数的最小整数值'''&lt;br /&gt;
|-&lt;br /&gt;
| '''CEILING()''' || 返回'''不小于参数的最小整数值'''&lt;br /&gt;
|-&lt;br /&gt;
| CONV() || 在不同的基数之间转换数字【？？？】&lt;br /&gt;
|-&lt;br /&gt;
| COS() || 返回余弦&lt;br /&gt;
|-&lt;br /&gt;
| COT() || 返回余切&lt;br /&gt;
|-&lt;br /&gt;
| CRC32() || 计算循环冗余校验值&lt;br /&gt;
|-&lt;br /&gt;
| DEGREES() || 将弧度转换为度&lt;br /&gt;
|-&lt;br /&gt;
| '''EXP()''' || 返回'''e的幂'''（e 为自然对数的底）【反函数是“LOG()”(仅使用单个参数)或“LN()”】&lt;br /&gt;
|-&lt;br /&gt;
| '''FLOOR()''' || 返回'''不大于参数的最大整数值'''&lt;br /&gt;
|-&lt;br /&gt;
| LN() || 返回参数的自然对数&lt;br /&gt;
|-&lt;br /&gt;
| LOG() || 返回第一个参数的自然对数&lt;br /&gt;
|-&lt;br /&gt;
| LOG10() || 返回参数的以 10 为底的对数&lt;br /&gt;
|-&lt;br /&gt;
| LOG2() || 返回参数的以 2 为底的对数&lt;br /&gt;
|-&lt;br /&gt;
| MOD() || 取余&lt;br /&gt;
|-&lt;br /&gt;
| PI() || 返回 pi 的值&lt;br /&gt;
|-&lt;br /&gt;
| '''POW()''' || 将自变量提高到指定的'''幂'''&lt;br /&gt;
|-&lt;br /&gt;
| '''POWER()''' || 将自变量提高到指定的'''幂'''&lt;br /&gt;
|-&lt;br /&gt;
| RADIANS() || 返回参数转换为弧度&lt;br /&gt;
|-&lt;br /&gt;
| RAND() || 返回一个随机浮点值&lt;br /&gt;
|-&lt;br /&gt;
| '''ROUND()''' || 返回'''近似值'''（四舍五入）【】&lt;br /&gt;
|-&lt;br /&gt;
| SIGN() || 返回参数的符号&lt;br /&gt;
|-&lt;br /&gt;
| SIN() || 返回参数的正弦&lt;br /&gt;
|-&lt;br /&gt;
| '''SQRT()''' || 返回参数的'''平方根'''&lt;br /&gt;
|-&lt;br /&gt;
| TAN() || 返回参数的正切值&lt;br /&gt;
|-&lt;br /&gt;
| '''TRUNCATE()''' || 截断为指定的小数位数&lt;br /&gt;
|}&lt;br /&gt;
* 发生错误时，所有 math 函数均返回“NULL”。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“'''CONV(N,from_base,to_base)'''”：在不同的数字基数之间转换数字。返回数字“N”的字符串表示形式，从基数“from_base”转换为基数“to_base”。【？？？】&lt;br /&gt;
* 如果任何参数为 NULL，则返回 NULL。&lt;br /&gt;
* 参数“N”被解释为整数，但可以指定为整数或字符串。&lt;br /&gt;
* 最小底数是 2，最大底数是 36。如果“from_base”为负数，则“N”被视为带符号的数字。否则，“N”被视为无符号数。&lt;br /&gt;
* “CONV()”以 64 位精度工作。&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
mysql&amp;gt; SELECT CONV('a',16,2);&lt;br /&gt;
        -&amp;gt; '1010'&lt;br /&gt;
mysql&amp;gt; SELECT CONV('6E',18,8);&lt;br /&gt;
        -&amp;gt; '172'&lt;br /&gt;
mysql&amp;gt; SELECT CONV(-17,10,-18);&lt;br /&gt;
        -&amp;gt; '-H'&lt;br /&gt;
mysql&amp;gt; SELECT CONV(10+'10'+'10'+X'0a',10,10);&lt;br /&gt;
        -&amp;gt; '40'&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“'''ROUND(X)''', '''ROUND(X,D)'''”：将参数“X”舍入为“D”小数位。&lt;br /&gt;
* '''舍入算法取决于“X”的数据类型'''。&lt;br /&gt;
* “D”如果未指定，则默认为'''0'''。&lt;br /&gt;
* “D”可以为负，导致“D”值“X”小数点后的数字变为零。&lt;br /&gt;
* “D”的最大绝对值为'''30'''；超过30(或-30)的任何数字都将被截断。&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
mysql&amp;gt; SELECT ROUND(-1.23);&lt;br /&gt;
        -&amp;gt; -1&lt;br /&gt;
mysql&amp;gt; SELECT ROUND(-1.58);&lt;br /&gt;
        -&amp;gt; -2&lt;br /&gt;
mysql&amp;gt; SELECT ROUND(1.58);&lt;br /&gt;
        -&amp;gt; 2&lt;br /&gt;
mysql&amp;gt; SELECT ROUND(1.298, 1);&lt;br /&gt;
        -&amp;gt; 1.3&lt;br /&gt;
mysql&amp;gt; SELECT ROUND(1.298, 0);&lt;br /&gt;
        -&amp;gt; 1&lt;br /&gt;
mysql&amp;gt; SELECT ROUND(23.298, -1);&lt;br /&gt;
        -&amp;gt; 20&lt;br /&gt;
mysql&amp;gt; SELECT ROUND(.12345678901234567890123456789012345, 35);&lt;br /&gt;
        -&amp;gt; 0.123456789012345678901234567890&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
“ROUND()”根据第一个参数的类型使用以下规则：&lt;br /&gt;
* 对于精确值数字，“ROUND()”使用“'''从零开始舍入一半'''”或“'''向最接近的舍入'''”规则：&lt;br /&gt;
*# 小数部分为“.5”或更大的值时：如果为正数，则入到下一个整数；如果为负数，则舍到下一个整数。（换句话说，四舍五入到零）&lt;br /&gt;
*# 小数部分小于“.5”的值：如果为正数，则舍到下一个整数；如果为负数，则入到下一个整数。&lt;br /&gt;
* 对于近似值数字，结果取决于 C 库。在许多系统上，这意味着“ROUND()”使用“'''四舍五入到最接近的偶数'''”规则：小数部分恰好位于两个整数中间的值将四舍五入为最接近的偶数整数。&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
mysql&amp;gt; SELECT ROUND(2.5), ROUND(25E-1);&lt;br /&gt;
+------------+--------------+&lt;br /&gt;
| ROUND(2.5) | ROUND(25E-1) |&lt;br /&gt;
+------------+--------------+&lt;br /&gt;
| 3          |            2 |&lt;br /&gt;
+------------+--------------+&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“'''TRUNCATE(X,D)'''”：返回数字将“X”截取“D”小数位。&lt;br /&gt;
* '''所有数字均四舍五入'''。&lt;br /&gt;
* 如果“D”是0，则结果没有小数点或小数部分。&lt;br /&gt;
* “D”可以为负，导致“D”值“X”小数点后的数字变为零。&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
mysql&amp;gt; SELECT TRUNCATE(1.223,1);&lt;br /&gt;
        -&amp;gt; 1.2&lt;br /&gt;
mysql&amp;gt; SELECT TRUNCATE(1.999,1);&lt;br /&gt;
        -&amp;gt; 1.9&lt;br /&gt;
mysql&amp;gt; SELECT TRUNCATE(1.999,0);&lt;br /&gt;
        -&amp;gt; 1&lt;br /&gt;
mysql&amp;gt; SELECT TRUNCATE(-1.999,1);&lt;br /&gt;
        -&amp;gt; -1.9&lt;br /&gt;
mysql&amp;gt; SELECT TRUNCATE(122,-2);&lt;br /&gt;
       -&amp;gt; 100&lt;br /&gt;
mysql&amp;gt; SELECT TRUNCATE(10.28*100,0);&lt;br /&gt;
       -&amp;gt; 1028&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
</feed>