content_image/821833.jpg content_image/821832.jpg
<img src='content_image/821833.jpg'>

• * 

Multiplication: 

mysql> SELECT 3*5; -> 15 mysql> SELECT 18014398509481984*18014398509481984.0; -> 324518553658426726783156020576256.0 mysql> SELECT 18014398509481984*18014398509481984; -> out-of-range error 

Note 

If this operator is used with a BIGINT , the return value is also a BIGINT . This means that you should avoid using -  on integers that may have the value of − 2$^{63}$. 

The last expression produces an error because the result of the integer multiplication exceeds the 64-bit range of BIGINT  calculations. (See Section 11.1, “Numeric Data Types” .) 

• / 

Division: 

mysql> SELECT 3/5; -> 0.60 

Division by zero produces a NULL  result: 

mysql> SELECT 102/(1-1); -> NULL 

A division is calculated with BIGINT  arithmetic only if performed in a context where its result is converted to an integer. 

• DIV 

Integer division. Discards from the division result any fractional part to the right of the decimal point. 

If either operand has a noninteger type, the operands are converted to DECIMAL  and divided using DECIMAL  arithmetic before converting the result to BIGINT . If the result exceeds BIGINT  range, an error occurs. 

mysql> SELECT 5 DIV 2, -5 DIV 2, 5 DIV -2, -5 DIV -2; -> 2, -2, -2, 2 

• N  % M , N  MOD M 

Modulo operation. Returns the remainder of N  divided by M . For more information, see the description for the MOD()  function in Section 12.6.2, “Mathematical Functions” . 

## 12.6.2 Mathematical Functions 

## Table 12.10 Mathematical Functions 

<img src='content_image/821832.jpg'>

