What are Mathematical Functions on Snowflake?

464 viewsSnowflake Functions and Procedures
0

What are Mathematical Functions on Snowflake?

Daniel Steinhold Answered question July 26, 2023
0

1. ABS: Returns the absolute (positive) value of a number.
Example: **`ABS(-5)`** returns **`5`**.
2. ROUND: Rounds a number to a specified number of decimal places.
Example: **`ROUND(3.14159, 2)`** returns **`3.14`**.
3. CEIL: Returns the smallest integer greater than or equal to a number.
Example: **`CEIL(4.7)`** returns **`5`**.
4. FLOOR: Returns the largest integer less than or equal to a number.
Example: **`FLOOR(4.7)`** returns **`4`**.
5. POWER: Raises a number to a specified power.
Example: **`POWER(2, 3)`** returns **`8`**.
6. SQRT: Calculates the square root of a number.
Example: **`SQRT(16)`** returns **`4`**.
7. EXP: Calculates the exponential value of a number (e^x).
Example: **`EXP(2)`** returns **`7.389`**.
8. LOG: Calculates the natural logarithm of a number.
Example: **`LOG(10)`** returns **`2.302`**.
9. MOD: Calculates the remainder when one number is divided by another.
Example: **`MOD(10, 3)`** returns **`1`**.
10. TRUNC: Truncates a number to a specified number of decimal places or digits.
Example: **`TRUNC(3.14159, 3)`** returns **`3.141`**.

These are just a few examples of the mathematical functions available in Snowflake. Snowflake also supports additional functions like SIN, COS, TAN, ASIN, ACOS, ATAN, and more for trigonometric calculations. The Snowflake documentation provides a comprehensive list of mathematical functions with detailed explanations and usage examples.

Daniel Steinhold Answered question July 26, 2023