For arithmetic operators, there are binary operators for addition, subtraction, multiplication, or division, and unary operators to represent whether the number is positive or negative. The unary operators to represent the numbers' positive/negative status have higher priority over the binary operators.
Arithmetic Operators Supported by CUBRID
Arithmetic Operator |
Description |
Operator |
Return Value |
---|---|---|---|
+ |
Addition |
1+2 |
3 |
- |
Subtraction |
1-2 |
-1 |
* |
Multiplication |
1*2 |
2 |
/ |
Division. Returns quotient. |
1/2.0 |
0.500000000 |
DIV |
Division. Returns quotient. |
1 DIV 2 |
0 |
%, MOD |
Division. Returns quotient. |
1 % 2 |
1 |
expression mathematical_operator expression
expression :
• bit string
• character string
• numeric value
• date-time value
• collection value
• NULL
mathematical_operator :
• set_arithmetic_operator
• arithmetic_operator
arithmetic_operator :
• +
• -
• *
• /, DIV
• %, MOD
set_arithmetic_operator :
• UNION (Union)
• DIFFERENCE (Difference)
• INTERSECT | INTERSECTION (Intersection)