ABS Function in BigQuery
The ABS function in BigQuery returns the absolute value of a numeric expression. It effectively removes the negative sign if the number is negative, returning the distance of the number from zero.
Syntax
SQL
ABS(numeric_expression)
Example 1: Get the absolute value of a negative number.
SQL
SELECT ABS(-50.75) AS absolute_value;
Example 2: Get the absolute value of a positive number.
SQL
SELECT ABS(100) AS absolute_value;
Note: The data type of the return value is the same as the data type of the input expression.