Beginner

214. SIGN Function

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

📘 Lesson 214 of 728 ⏱ 8 min 🎯 Intermediate

The SIGN function identifies the sign of a numeric value. It commonly returns -1 for negative values, 0 for zero, and 1 for positive values.

Knowing the direction of a numeric difference can help classify gains, losses, increases, and decreases.

Classify sales variance as positive, negative, or zero.

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

SIGN is useful in variance analysis, financial reporting, performance monitoring, and trend classification.

  • SIGN identifies the direction of a number.
  • Negative values commonly return -1.
  • Zero commonly returns 0.
  • Positive values commonly return 1.
  • It is useful for classification.
What does SIGN return?

SIGN commonly returns -1 for negative values, 0 for zero, and 1 for positive values.

Why use SIGN in analysis?

It can classify whether a numeric difference represents a decrease, no change, or increase.

Have you finished this lesson?

Introduction to SQL – All Lessons