ID EN
Mathematical Functions

SIGN(X)

MySQL 8.4

Returns the sign of the argument as -1, 0, or 1, depending on whether X is negative, zero, or positive. Returns NULL if X is NULL.

Syntax

MYSQL
SELECT SIGN(-32);
-1
SELECT SIGN(0);
0
SELECT SIGN(234);
1

Examples

Example
MYSQL
SELECT SIGN(-32);
-1
SELECT SIGN(0);
0
SELECT SIGN(234);
1