7. NULL Values: Missing Data Done Right
7.1 What NULL Means (Unknown — Not Zero, Not Blank Text)
Why. Treating missing as zero invents fake money and fake averages.
What. NULL means unknown / missing. It is not 0 and not empty text ''.
How. Look at orders.note — many rows are NULL on purpose in raja_coffee.
Steps
- Browse orders and find blank note cells.
- Say: this is NULL, not zero.
- Never replace NULL with 0 unless the business says so.
Examples
Example 1 · dataset: raja_coffee
SELECT order_id, note FROM orders WHERE order_id IN (1001,1003,1013);Output
| order_id | note |
|---|---|
| 1001 | |
| 1003 | gift |
| 1013 | office stock |
Meaning. Some notes filled, some NULL (shown blank).
Ravindra Bagale's Tip
NULL is a status of the cell, not a value you typed.
Ravindra Bagale's Tip – मराठी
NULL हे सेलची स्थिती आहे, तुम्ही टाइप केलेले मूल्य नाही.
Ravindra Bagale's Tip – हिंदी
NULL सेल की स्थिति है, आपका टाइप किया मान नहीं।