w3resource

PostgreSQL ABS() function

ABS() function

The PostgreSQL abs() is used to return the absolute value of a number passed as an argument.

Syntax:

abs()

PostgreSQL Version: 9.3

Example: PostgreSQL ABS() function

Code:

SELECT ABS(115.36) AS "Absolute Value";

Output:

 Absolute Value
----------------
         115.36
(1 row)

Example: PostgreSQL ABS() function using negative value

Code:

SELECT  ABS(-115.36) AS "Absolute Value";

Sample Output:

 Absolute Value
----------------
         115.36
(1 row)

Previous: Mathematical and Trigonomitecal functions Introduction
Next: ACOS function



Share this Tutorial / Exercise on : Facebook and Twitter