MySQL SIGN() function
SIGN() function
MySQL SIGN() returns the sign of the argument.
The function returns 1 when the value of the argument is positive, returns -1 when the value of the argument is negative and return 0 when the value of the argument is 0.
Syntax:
SIGN(X);
Argument:
Name | Description |
---|---|
X | A number whose sign is to be retrieved. |
Syntax Diagram:

MySQL Version: 5.6
Pictorial presentation of MySQL SIGN() function
Example of MySQL SIGN() function
Code:
SELECT SIGN(-145), SIGN(0), SIGN(145);
Explanation:
The above MySQL statement will return the sign of given numbers -145, 0 and 145.
Sample Output:
mysql> SELECT SIGN(-145), SIGN(0), SIGN(145); +------------+---------+-----------+ | SIGN(-145) | SIGN(0) | SIGN(145) | +------------+---------+-----------+ | -1 | 0 | 1 | +------------+---------+-----------+ 1 row in set (0.00 sec)
All Mathematical Functions
- Weekly Trends
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
- JavaScript functions Exercises
- Python Tutorial
- Python Array Exercises
- SQL Cross Join
- C# Sharp Array Exercises
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook