bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL SIGN() Function

Concept visual

MySQL SIGN() Function

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

Example

Return the sign of a number:

SELECT SIGN(255.5);

Definition and Usage

The SIGN() function returns the sign of a number. This function will return one of the following:

Formula

If number > 0, it returns 1
If number = 0, it returns 0
If number < 0, it returns - 1

Syntax

Sign(

number )

Parameter Values

Parameter

Description number

Required. The number to return the sign for

Technical Details

Works in:

From MySQL 4.0

More Examples

Example

Return the sign of a number:

SELECT SIGN(-12);

Previous

❮ MySQL Functions

Next

Previous

MySQL ROUND() Function

Next

MySQL SIN() Function