Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

SIGN

Example

Provide the sign of a number.

SELECT SIGN(255.5);

Definition and Usage

The SIGN() function retrieves the numerical sign of a given number.

The SIGN() function yields:

  • 1 if the number is positive
  • 0 if the number is zero
  • -1 if the number is negative.

Syntax

SIGN(number)

Parameter Values

Parameter

Description

number

Necessary: The numerical value for which the sign needs to be determined

Technical Details

Works in:

 From MySQL version 4.0

More Examples

Example

Determine the sign of a given number.

SELECT SIGN(-12);