SIGN
All functions > MATH > SIGN
Returns the sign of a number: -1 for negative, 0 for zero, and 1 for positive.
Syntax
SIGN(expr)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
number | DOUBLE | Yes | The number to get the sign of |
Returns
BIGINT - Sign indicator (-1, 0, or 1)
Notes
- Returns -1 for any negative number
- Returns 0 for zero (positive or negative zero)
- Returns 1 for any positive number
- Returns NULL if the input is NULL
- Useful for conditional logic based on number sign