PostgreSQL数値関数SIGN
RANDOM

SIGN数値関数

DIV

正は1、0は0、負は-1を返します。

構文

SIGN(x)

使用例

下記の値を入力するとサンプルに即時反映されます。

profit
direction
financial_records
SELECT profit, SIGN(profit) AS direction
FROM financial_records;