Postgresql Sign Function
PostgreSQL: sign Function
In this PostgreSQL post explains how to use the PostgreSQL sign function with syntax and examples.
Description
The PostgreSQL sign function returns a value indicating the sign of a number.
Syntax
The syntax for the sign function in PostgreSQL is:
Parameters or Arguments
- number
The number to test for its sign.
Note
- The sign function returns -1, if the number is less than 0.
- The sign function returns 0, if the number is equal to 0.
- The sign function returns 1, if the number is greater than 0.
Applies To
The sign function can be used in the following versions of PostgreSQL:
- PostgreSQL 9.4, PostgreSQL 9.3, PostgreSQL 9.2, PostgreSQL 9.1, PostgreSQL 9.0, PostgreSQL 8.4
Example
Let's look at some PostgreSQL sign function examples and explore how to use the sign function in PostgreSQL.
For example: