Dofactory.com
Dofactory.com
Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

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



Last updated on Dec 21, 2023

Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.