SIGN()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the sign of the argument.
USAGE
SIGN(number)
Argument Name | Description |
|---|---|
| The numeric whose sign is to be determined |
DETAILS
SIGN() is a mathematical function that returns the sign of the argument as -1, 0, or 1 for negative, zero, and positive numeric values respectively.
The number argument can be any numeric data type, or a literal value that can be much larger than any data type accepts.
A NULL is returned if the argument is NULL.
EXAMPLES
SELECT SIGN(-10);
+-----------+
| SIGN(-10) |
+-----------+
| -1 |
+-----------+
SELECT SIGN(123);
+-----------+
| SIGN(123) |
+-----------+
| 1 |
+-----------+
SELECT SIGN(922337203685477580792233720368547750000000000000000000000) AS result;
+--------+
| result |
+--------+
| 1 |
+--------+
