The SIGN function returns an indicator showing whether a numeric expression is negative, zero, or positive. The exact returned values depend on the database implementation, commonly -1, 0, and 1.
SIGN provides a simple way to classify numeric differences according to their direction.
Identify whether sales variance is negative, zero, or positive.
SELECT
EmployeeID,
ActualSales - TargetSales AS Variance,
SIGN(ActualSales - TargetSales) AS VarianceDirection
FROM EmployeeSales;
SIGN is useful for variance analysis, financial monitoring, exception reporting, and classification of numeric changes.
- SIGN identifies the direction of a number.
- Negative values are commonly represented by -1.
- Zero is commonly represented by 0.
- Positive values are commonly represented by 1.
- It is useful for variance classification.
What does SIGN return?
SIGN returns an indicator showing whether a numeric expression is negative, zero, or positive.
How can SIGN help with variance analysis?
SIGN can quickly classify whether a variance is below, equal to, or above zero.