Skip to content
SQLSimplified
numeric

SIGN()

Returns -1, 0, or 1 indicating the sign of a number.

Description

SIGN tells you the sign of a number: -1 for negative, 0 for zero, and 1 for positive. It's a quick way to bucket values into negative/zero/positive without writing a CASE expression.

Syntax

SIGN(expression)

Parameters

NameDescriptionOptional
expressionA numeric column or expression.No

Return Type

Returns an INTEGER (-1, 0, or 1).

Examples

Employees & Departments

Loading database engine...

Employees & Departments

Loading database engine...

Bucket with SIGN

CASE SIGN(x) WHEN -1 THEN 'neg' WHEN 0 THEN 'zero' ELSE 'pos' END is a tidy way to label a value's direction.

Common Mistakes

  • Expecting the magnitude. SIGN returns only -1/0/1, never the size of the number — use ABS for magnitude.
  • Applying to text. It needs a number.
  • Confusing with comparison. SIGN(x) is not a boolean; it's a category.

See also: ABS, ROUND.

Search

Search lessons, functions, examples, and practice problems