MySQL숫자 함수SIGN
RAND

SIGN숫자 함수

PI

양수는 1, 0은 0, 음수는 -1을 반환합니다.

문법

SIGN(x)

예제

아래 값을 입력하면 예제에 즉시 반영됩니다.

order_id
profit
direction
financial_records
-- 손익 방향 표시
SELECT order_id, profit, SIGN(profit) AS direction
FROM financial_records;