SQL ABS Function
SQL ABS () function is used to return the absolute value of a number. SQL ABS () function can be used with NUMBER data type columns only. Absolute number is a number without any positive or negative sign. Actually, it converts negative number to positive and leave positive numbers as it is. The syntax is:
ABS (number);
Example:
The following statement uses SQL ABS () function to return absolute values of employee salaries from employee table.
SELECT full_name, ABS(salary) FROM employee;
Output:
Note: If there are any negative salary values, they will be converted to positive numbers by SQL ABS () function.