Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
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);