The following table shows the mathematical operators that are available for the standard numeric types. Unless noted otherwise, all the operators return the same data type as their argument(s). The right arrow (⇒ ) is used to indicate the result.Documentation Index
Fetch the complete documentation index at: https://docs.regatta.dev/llms.txt
Use this file to discover all available pages before exploring further.
| Operator | Description and Comments | Example | ||
|---|---|---|---|---|
numeric_type + numeric_type | Addition | 10 + 5=> 15 | ||
+ numeric_type | Unary plus (no operation) | +10.5=> 10.5 | ||
numeric_type - numeric_type | Subtraction | 10 - 5=> 5 | ||
- numeric_type | Negation | -10=> (-10) | ||
numeric_type * numeric_type | Multiplication | 10 * 5=> 50 | ||
numeric_type / numeric_type | Division See also DIV(). See notes. | 5 / 2 => 26 / 2 => 3 | ||
numeric_type % numeric_type | Modulo See also MOD(). See notes. | 5 % 3=> 2 | ||
numeric_type ^ numeric_type | Exponentiation See also EXP(). See notes. | 2 ^ 3=> 8 2.0 ^ (3.0 * 3.0)=> 134217728.0 | ||
| ` | / numeric_type` | Square root | ` | / 9.0` => 3.0 |
@ numeric_type | Absolute See also ABS() | @ -66.7=> 66.7 |
-
Division operator (/): Dividing
integral_typesreturns the quotient of the integer division. To perform real numbers division, at least one of the operands should be non-integer. For example:
SELECT 5/2;Result: 2SELECT 5/2::DECIMAL;SELECT 5.0/2;Result: 2.5000000000000000 -
Exponentiation operator (^): By default, multiple uses of ^ are associated left to right.
For example:
SELECT 2 ^ (3 ^ 3);Result: 134,217,728SELECT 2 ^ 3 ^ 3;Result: 512 -
Modulo operator(
%): Arguments can be eitherintegral_type(INT,BIGINT,SMALLINT) orDECIMAL. It cannot be floating-point numbers (FLOATorREAL).