SQL ABS Function

The ABS function returns the absolute value of a number.

ABS changes all numbers to positive values.

ABS has no effect on zero values.

Example

#

This example returns the absolute values for the input numbers.

SELECT ABS(-15.6) AS '-15.6',
       ABS(0.4) AS '0.4',
       ABS(-8.91) AS '-8.91'
Result:  1 record
-15.6 0.4 -8.91
15.6 0.4 8.91

Syntax

Syntax of the ABS function.

ABS(number)

number -- a number to convert to an absolute value.


You may also like



Guides


vsn 3.1