ABS()

Overview

Returns the absolute (non-negative) value of the given argument.

USAGE

ABS(number)

Argument Name

Description

number

The number to evaluate

DETAILS

ABS() is a mathematical function that returns the absolute value of its argument:

  • If the argument is NULL the result is NULL

  • If the argument is >= 0, the result is the argument value.

  • Otherwise, the result is -1 multiplied by the argument value.

The data type of the result is the same as the data type of the argument.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SELECT ABS(-5), ABS(8);
+---------+--------+
| ABS(-5) | ABS(8) |
+---------+--------+
|       5 |      8 |
+---------+--------+

Out-of-Range

A value is considered "out-of-range" when it is too small or too large to be stored in a data type. The value is rounded to the nearest valid value.

SELECT ABS(-9223372036854775808);
+---------------------------+
| ABS(-9223372036854775808) |
+---------------------------+
|      -9223372036854775808 |
+---------------------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES