MariaDB: SIGN Function
This MariaDB tutorial explains how to use the MariaDB SIGN function with syntax and examples.
Description
The MariaDB SIGN function returns a value indicating the sign of a number.
Syntax
The syntax for the SIGN function in MariaDB is:
SIGN( number )
Parameters or Arguments
- number
- The number to test for its sign.
Note
- The SIGN function returns -1, if the number is less than 0.
- The SIGN function returns 0, if the number is equal to 0.
- The SIGN function returns 1, if the number is greater than 0.
Applies To
The SIGN function can be used in the following versions of MariaDB:
- MariaDB 10
Example
Let's look at some MariaDB SIGN function examples and explore how to use the SIGN function in MariaDB.
For example:
SELECT SIGN(5); Result: 1 SELECT SIGN(0); Result: 0 SELECT SIGN(-5); Result: -1
Advertisements