| Expression & Operators |
| |
| Arithmatic Operators |
| |
| MySQL includes several kinds of operators that can be used to combine terms of expressions. Arithmetic operators, include the usual addition, subtraction, multiplication, and division operators, as well as the modulo operator. |
| |
| Arithmetic is performed using BIGINT (64-bit) integer values for +, -, and * when both operands are integers, as well as for / and % when the operation is performed in a context where the result is expected to be an integer. |
| |
| Otherwise, DOUBLE is used. Be aware that if an integer operation involves large values such that the result exceeds 64-bit range, you will get unpredictable results. (Actually, you should try to avoid exceeding 63-bit values; one bit is needed to represent the sign.) |
| |
| Arithmetic Operators |
| +, -, *, / |
basic arithmetic |
| % |
mod (remainder of integer division) |
| DIV |
alternative division operator (since MySQL 4.1) |
| MOD |
alternative modulo operator (since MySQL 4.1) |
|
| |
| |
|
|
| |
| |