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 |