Name

ABS

All platforms support the ANSI standard ABS function.

ANSI SQL Standard Syntax

ABS( expression )

ABS returns the absolute value of the number in expression.

Example

The following example shows how to use the ABS function:

/* SQL2003 */
SELECT ABS(−1) FROM NUMBERS
1

Get SQL in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.