Understanding SQL NULL
NULL means 'unknown' or 'missing' — not zero, not an empty string, and genuinely not equal to anything, including another NULL.
What & Why
NULL represents an absent or unknown value. A missing product.feedback.nps_score does not mean a score of zero or an empty string; it means no NPS score was submitted for that feedback row.
NULL is not equal to anything, including another NULL. NULL = NULL evaluates to UNKNOWN, which is why SQL provides IS NULL and IS NOT NULL for missing-value tests.
See How It Works
BUSINESS QUESTION
Product wants to compare = NULL with IS NULL against the real nullable nps_score column.
| id | user_id | feature_id | rating | nps_score | comment | created_at |
|---|---|---|---|---|---|---|
| 1 | 101 | 1 | 5 | 9 | Clear and useful | 2024-01-25 12:15:00+00 |
| 2 | 102 | 2 | 4 | NULL | Export worked well | 2024-02-20 15:40:00+00 |
| 3 | 103 | 1 | 4 | 7 | Helpful setup flow | 2024-03-18 09:05:00+00 |
| 4 | 104 | 3 | 3 | NULL | Needs clearer timing | 2024-04-08 17:30:00+00 |
Watch SQL distinguish comparison from IS NULLStep 1 of 4
nps_score = NULL
| id | nps_score | expression | result |
|---|---|---|---|
| 2 | NULL | NULL = NULL | UNKNOWN |
Ordinary equality with NULL is UNKNOWN—even when the stored NPS score is NULL.
EXAMPLE QUERY
SELECT
id,
nps_score,
nps_score = NULL AS equals_null,
nps_score IS NULL AS is_null
FROM product.feedback
ORDER BY id;Sign up free to try it on a real business scenario