SIGN

Syntax

SIGN( number )

Description

Returns the sign of the number number:

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

Argument types:

  • numberFractional number | Integer

Return type: Integer

Example

[value] SIGN([value])
1.00 1
0.10 1
-2.00 -1
50.50 1
0.00 0
-3.50 -1

Data source support

ClickHouse 19.13, Microsoft SQL Server 2017 (14.0), MySQL 5.6, PostgreSQL 9.3.

Previous
Next