You are viewing an older version of this section. View current production version.
Join the MemSQL Community Today
Get expert advice, develop skills, and connect with others.

SIGN

This function returns 1 if the argument is positive, -1 if it is negative, and 0 if it is 0.

Syntax

SIGN ( expression )

Arguments

  • expression: any valid numeric expression.

Return Type

Integer.

Examples

memsql> select sign(6), sign(-6), sign(0);
+---------+----------+---------+
| sign(6) | sign(-6) | sign(0) |
+---------+----------+---------+
|       1 |       -1 |       0 |
+---------+----------+---------+