Basic Functions
This chapter introduces basic functions applicable to SQL statements.
Arithmetic functions
| Syntax | Description | Example | Model | Push down | Computed Column |
|---|---|---|---|---|---|
| ABS(num) | Returns the absolute value of num | ABS(-2) = 2 | ⎷️ | ⎷️ | ⎷️ |
| CEIL(num) | Rounds num up, returning the smallest integer that is greater than or equal to num | CEIL(-2.2) = -2 | ⎷️ | ⎷️ | ⎷️ |
| FLOOR(num) | Rounds num down, returning the largest integer that is less than or equal to num | FLOOR(-2.2) = -3 | ⎷️ | ⎷️ | ⎷️ |
| MOD(num1, num2) | Returns the remainder (modulus) of num1 divided by num2. The result is negative only if num1 is negative | MOD(-3, 2) = -1 | ⎷️ | ⎷️ | ✕ |
| SQRT(num) | Returns the square root of num | SQRT(16) = 4.0 | ⎷️ | ⎷️ | ⎷️ |
| CBRT(num) | Returns the cube root of num | CBRT(27.0) = 3.0 | ⎷️ | ⎷️ | ⎷️ |
| HYPOT(num1, num2) | Returns the Euclidean distance of num1 and num2 | HYPOT(3, 4) = 5.0 | ⎷️ | ⎷️ | ⎷️ |
| LN(num) | Returns the natural logarithm (base e) of num | LN(2) = 0.6931471805599453 | ⎷️ | ⎷️ | ⎷️ |
| LOG(base, num) | Returns the logarithm of num with base | LOG(10, 100) = 2.0 | ⎷️ | ⎷️ | ⎷️ |
| LOG10(num) | Returns the base 10 logarithm of numeric | LOG10(100) = 2.0 | ⎷️ | ⎷️ | ⎷️ |
| LOG1P(num) | Returns ln(1 + num) | LOG1P(0) = 0.0 | ⎷️ | ⎷️ | ⎷️ |
| LOG2(num) | Returns the logarithm of num with base 2 | LOG2(2) = 1.0 | ⎷️ | ⎷️ | ⎷️ |
| EXP(num) | Returns e raised to the power of num | EXP(1) = 2.718281828459045 | ⎷️ | ⎷️ | ⎷️ |
| EXPM1(num) | Returns exp(num) - 1 | EXPM1(0) = 0.0 | ⎷️ | ⎷️ | ⎷️ |
| POWER(num1, num2) | Returns num1 raised to the power of num2 | OWER(5,2) = 25.0 |