Name

SIGN()

Synopsis

SIGN(number)

This function returns –1 if the given number is a negative, 0 if it is zero, and 1 if it is positive. Here is an example:

SELECT SIGN(-5);

+----------+
| SIGN(-5) |
+----------+
|       -1 |
+----------+

Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.