12.6.1 Arithmetic Operators算术运算符

Table 12.9 Arithmetic Operators算术运算符

Name名称Description描述
%, MODModulo operator求模运算符
*Multiplication operator乘法运算符
+Addition operator加法运算符
-Minus operator加法运算符
-Change the sign of the argument改变参数的符号
/Division operator除法运算符
DIVInteger division整除

The usual arithmetic operators are available. 通常的算术运算符是可用的。The result is determined according to the following rules:根据以下规则确定结果:

These rules are applied for each operation, such that nested calculations imply the precision of each component. 这些规则应用于每个操作,因此嵌套计算意味着每个组件的精度。Hence, (14620 / 9432456) / (24250 / 9432456), resolves first to (0.0014) / (0.0026), with the final result having 8 decimal places (0.60288653).因此,(14620 / 9432456) / (24250 / 9432456)首先解析为(0.0014) / (0.0026),最终结果有8位小数(0.60288653)。

Because of these rules and the way they are applied, care should be taken to ensure that components and subcomponents of a calculation use the appropriate level of precision. 由于这些规则及其应用方式,应注意确保计算的组件和子组件使用适当的精度级别。See Section 12.11, “Cast Functions and Operators”.请参阅第12.11节,“强制转换函数和运算符”

For information about handling of overflow in numeric expression evaluation, see Section 11.1.7, “Out-of-Range and Overflow Handling”.有关数字表达式求值中溢出处理的信息,请参阅第11.1.7节,“超出范围和溢出处理”

Arithmetic operators apply to numbers. 算术运算符适用于数字。For other types of values, alternative operations may be available. 对于其他类型的值,可以使用替代操作。For example, to add date values, use DATE_ADD(); see Section 12.7, “Date and Time Functions”.例如,要添加日期值,请使用DATE_ADD();请参阅第12.7节,“日期和时间函数”