Skip to main content


Returns the absolute value of the numeric argument.

See also:


SELECT ABS(numeric_expression) FROM <multipartIdentifier>;

abs(X) returns NULL if X is NULL. abs(X) returns 0.0 if X is a string or blob that cannot be converted to a numeric value. If X is the integer -9223372036854775808 then abs(X) throws an integer overflow error since there is no equivalent positive 64-bit two complement value.


An expression of the exact numeric or approximate numeric data type category.

Return Value(s)

Returns a positive numeric value.


Return the absolute value of a number

SELECT name, abs(strftime('%s', creationTimestamp)-strftime('%s','now')) as abs_value
FROM google.compute.instances
WHERE project = 'stackql-demo'
AND zone = 'australia-southeast1-a';

For more information, see