← Module 05 · Database & SQL
MODULE 05 · DATABASE & SQL
NULL
NULL is a special database marker meaning a value is missing, unknown, or not applicable.
01 · What is it?
NULL means that a value is missing, unknown, or not applicable.
It is not the same thing as zero, an empty string, or the word “NULL”. It represents the absence of a usable value.
Simple definition: NULL says, “There is no known value here.”
02 · Think of it like…
Think of NULL as a blank answer on a form when the answer is not known or does not apply.
| Value | Meaning |
| NULL | No usable value is known or needed. |
| 0 | The known number is zero. |
| '' | The known text is empty. |
| 'NULL' | The text literally says “NULL”. |
NULLAnswer not known
or not applicable
03 · What does it do?
NULL lets a database record that a field does not currently have a usable value.
Preserves uncertainty
It keeps “unknown” different from a guessed value.
Represents not applicable
It can show that a field does not apply to this record.
Changes comparisons
SQL treats NULL as unknown, so ordinary equality checks do not match it.
04 · Where is it used?
NULL appears in real data whenever information can arrive later, be optional, or not apply.
Optional profile data
A user has not added a phone number or middle name.
Pending workflows
An order has no shipped date because it has not shipped yet.
Missing measurements
A sensor or imported record did not provide a reading.
05 · Example
Finding orders without a shipped date
SELECT order_id, shipped_at
FROM orders
WHERE shipped_at IS NULL;
Use IS NULL to test for NULL. Writing shipped_at = NULL does not work because NULL is not an ordinary value to compare with equals.
06 · How it connects
Input data→
Validation→
Database column→
NULL or known value→
Query result
A column definition can allow or reject NULL, and queries must use NULL-aware conditions when they need missing records.
07 · Do Not Confuse
NULL
A missing, unknown, or not-applicable value.
Zero
A known numeric value whose amount is 0.
Empty string
A known text value containing no characters.
NULL ≠ 0 ≠ ''. They carry different meanings and can behave differently in queries.
08 · Topic Glossary
| ENGLISH TERM | 中文 | SIMPLE ENGLISH | 中文小白理解 |
| NULL | 空值 / 未知值 | A marker for a missing, unknown, or not-applicable value. | 表示数据缺失、未知或不适用的特殊标记。 |
| Missing Value | 缺失值 | A value that is not available in the data. | 数据中目前没有提供的值。 |
| Unknown Value | 未知值 | A value that may exist but is not known yet. | 可能存在,但现在还不知道具体是什么的值。 |
| IS NULL | 判断空值 | An SQL condition used to find NULL values. | SQL 中用来查找 NULL 的判断条件。 |
| IS NOT NULL | 判断非空值 | An SQL condition used to find values that are not NULL. | SQL 中用来查找不是 NULL 的值的判断条件。 |
| NOT NULL | 非空约束 | A rule that requires a column to have a value. | 要求某一列必须有值,不能保存 NULL 的规则。 |
| Empty String | 空字符串 | Text with zero characters, written as ''. | 长度为零的文字,不等于 NULL。 |
| Default Value | 默认值 | A value used automatically when no value is supplied. | 用户没有提供值时,系统自动填入的值。 |
09 · What to Remember
- NULL means missing, unknown, or not applicable.
- NULL is different from zero, an empty string, and the text “NULL”.
- Use IS NULL or IS NOT NULL when filtering for NULL values.