This SQLite post explains how to use the SQLite abs function with syntax and examples.
The SQLite abs function returns the absolute value of a number.
The syntax for the abs function in SQLite is:
abs( number )
The number to convert to an absolute value.
The abs function can be used in the following versions of SQLite:
Let's look at some SQLite abs function examples and explore how to use the abs function in SQLite.
For example:
sqlite> SELECT abs(-5);
Output: 5
sqlite> SELECT abs(-5.7);
Output: 5.7
sqlite> SELECT abs(7 - 10);
Output: 3
sqlite> SELECT abs(12.79);
Output: 12.79
sqlite> SELECT abs(25 * -2);
Output: 50
sqlite> SELECT abs(-3);
Output: 3
sqlite> SELECT abs('-3');
Output: 3.0
sqlite> SELECT abs(NULL);
Output: NULL
sqlite> SELECT abs('AODBA');
Output: 0.0