totn MariaDB Functions

MariaDB: ABS Function

This MariaDB tutorial explains how to use the MariaDB ABS function with syntax and examples.

Description

The MariaDB ABS function returns the absolute value of a number.

Syntax

The syntax for the ABS function in MariaDB is:

ABS( number )

Parameters or Arguments

number
The number to convert to an absolute value.

Applies To

The ABS function can be used in the following versions of MariaDB:

  • MariaDB 10

Example

Let's look at some MariaDB ABS function examples and explore how to use the ABS function in MariaDB.

For example:

SELECT ABS(-300);
Result: 300

SELECT ABS(-300.5);
Result: 300.5

SELECT ABS(-300.52);
Result: 300.52

SELECT ABS(4);
Result: 4

SELECT ABS(25 * -2);
Result: 50