ABS()
ABS() is a SQL function in the Numeric Functions category. Returns the absolute (positive) value of a number. The syntax is ABS(number). It accepts number. It returns absolute value. A typical example: SELECT ABS(-5); -- 5 SELECT ABS(price - target_price) AS difference FROM products; A close relative is ROUND(), which rounds a number to a specified number of decimal places. A close relative is CEIL() / CEILING(), which returns the smallest integer greater than or equal to a number (rounds up). A close relative is FLOOR(), which returns the largest integer less than or equal to a number (rounds down). More about this category: Mathematical functions — ROUND, ABS, CEIL, FLOOR, POWER, SQRT, MOD. Related Numeric Functions entries: ROUND(), CEIL() / CEILING(), FLOOR(), POWER() / POW(), SQRT(), MOD(), GREATEST() / LEAST(), RAND() / RANDOM(). This page is part of the free SQL Reference documentation covering 762+ statements, functions, and clauses, each with syntax, parameters, return values, and examples for MySQL, PostgreSQL, SQL Server, and SQLite.