Beginner

187. NULL vs Zero

Understand the important difference between NULL and the numeric value zero.

📘 Lesson 187 of 728 ⏱ 9 min 🎯 Beginner

NULL represents missing, unknown, or unavailable information, while zero is an actual numeric value representing 0.

Confusing NULL with zero can produce incorrect calculations, filters, reports, and business conclusions.

A sales amount of 0 means no sales were recorded, while NULL may mean the sales value is unknown or not available.

SQL
SELECT
    EmployeeName,
    Salary
FROM Employees
WHERE Salary IS NULL
   OR Salary = 0;

This distinction is important in financial reporting, sales analysis, customer analytics, and data-quality checks.

  • NULL means missing or unknown information.
  • Zero is an actual numeric value.
  • NULL and zero are not equivalent.
  • IS NULL is used to check NULL.
  • = 0 is used to check zero.
  • The distinction matters in calculations.
What is the difference between NULL and zero?

NULL represents missing or unknown information, while zero is an actual numeric value.

Can NULL be treated as zero automatically?

No. NULL and zero have different meanings and should be handled explicitly.

Have you finished this lesson?

Introduction to SQL – All Lessons