SIGN()
SIGN() is a SQL function in the Numeric Functions category. Returns the sign of a number: 1 for positive, 0 for zero, -1 for negative. The syntax is SIGN(number). It accepts number. It returns -1, 0, or 1. A typical example: SELECT SIGN(42); -- 1 SELECT SIGN(-5); -- -1 SELECT SIGN(0); -- 0 A close relative is ROUND(), which rounds a number to a specified number of decimal places. A close relative is ABS(), which returns the absolute (positive) value of a number. A close relative is CEIL() / CEILING(), which returns the smallest integer greater than or equal to a number (rounds up). More about this category: Mathematical functions — ROUND, ABS, CEIL, FLOOR, POWER, SQRT, MOD. Related Numeric Functions entries: ROUND(), ABS(), CEIL() / CEILING(), FLOOR(), POWER() / POW(), SQRT(), MOD(), GREATEST() / LEAST(). 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.