Beginner

259. SIGN Function

Learn how to determine whether a number is negative, zero, or positive.

📘 Lesson 259 of 728 ⏱ 8 min 🎯 Intermediate

The SIGN function returns an indicator representing whether a numeric expression is negative, zero, or positive.

SIGN can simplify logic when only the direction of a numeric value matters rather than its exact size.

Identify whether a sales variance is positive, negative, or zero.

SQL
SELECT
    EmployeeID,
    SIGN(ActualSales - TargetSales) AS VarianceDirection
FROM EmployeeSales;

SIGN is useful in variance analysis, financial reporting, trend classification, and conditional calculations.

  • SIGN identifies numeric direction.
  • Negative values produce a negative indicator.
  • Zero produces zero.
  • Positive values produce a positive indicator.
  • It can simplify conditional logic.
What does SIGN do?

SIGN indicates whether a numeric value is negative, zero, or positive.

Where can SIGN be useful?

SIGN is useful when analyzing the direction of differences, such as positive or negative business variances.

Have you finished this lesson?

Introduction to SQL – All Lessons