Skip to content

Latest commit

 

History

History
63 lines (43 loc) · 1.4 KB

File metadata and controls

63 lines (43 loc) · 1.4 KB
description
Returns the sign of the input expression.

SIGN

Syntax

SIGN(numeric_expression double) → int

  • numeric_expression: Input expression.

Examples

{% code title="SIGN example" %}

SELECT SIGN(10.3)
-- 1

{% endcode %}

SIGN(numeric_expression int32) → int32

  • numeric_expression: Input expression.

Examples

{% code title="SIGN example" %}

SELECT SIGN(-5)
-- -1

{% endcode %}

SIGN(numeric_expression int64) → int64

  • numeric_expression: Input expression.

Examples

{% code title="SIGN example" %}

SELECT SIGN(24)
-- 1

{% endcode %}

SIGN(numeric_expression float) → int

  • numeric_expression: Input expression.

Examples

{% code title="SIGN example" %}

SELECT SIGN(0.0)
-- 0

{% endcode %}

Usage Notes

1 is returned if the input expression is positive. -1 is returned if the input expression is negative. 0 is returned if the input expression is 0.