SQL for BAs: NULL and missing values
Missing values change counts, sums and filters. Learn how NULL behaves so your numbers match what the business expects.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: a blank box on a survey. Someone skips a question. The blank is not a yes, and it is not a no. If you count answers, the blanks are not in the count. If you say 70 percent said yes, you must say 70 percent of whom.
Daily List is a made-up to-do app (SYNTHETIC / TRAINING ONLY). Sam, the , counts tasks that have a due date. One task has none.
What it is: (Structured Query Language) asks questions of tables. A table is a grid, a row is one record, and a column is one fact. marks a missing or unknown value. It is not zero and not an empty text. The NULL (analyst view) test is IS NULL, never = NULL. COALESCE swaps a null for a stand-in word. COUNT(*) and COUNT(column) are different: the star counts rows, and the column skips nulls. WHERE status <> 'done' also drops rows whose status is null. That surprise is the neighbour of a normal "not equal" filter.
Why it matters: Nina asks for the average priority. The average of the nine filled priorities is 3.0. Treating the blank as zero makes it 2.7. Both numbers are real. They answer different questions. Sam has to say which one.
A tool that draws a blank and a zero the same way can hide this gap.
PLAIN WORDS · 1 in this section
- coalesce
- SQL tool that swaps a null for a value
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the work.
THE REAL JOB Counting answers on a survey with blank boxes.
- Rows
- Values
- Gap
HOW THE PICTURE MAPS
| In the picture | In the work |
|---|---|
| A blank box | NULL |
| Counting answers | COUNT(column) |
| Counting forms | COUNT(*) |
| Writing Unknown | COALESCE |
WHERE THIS PICTURE STOPS
- A blank on paper is seen, but NULL hides in a table.
- A person can be asked, but a query cannot.
- A survey is small, but tables are large.
HOOK
Count both.
TELL A FRIEND
A survey: say seventy percent of whom.
OFTEN MIXED UP WITH SQL for BAs: SELECT and WHERE. That topic filters rows. This one explains the blank values that filters and totals skip.
PRACTISE AND KEEP
Sources for this topic — 5 sources
- Market practice
Conditional expressions (PostgreSQL documentation) ↗ — PostgreSQL · PostgreSQL 18, §9.18 CASE/COALESCE/NULLIF; publisher page opened6November 2026. Dialect scope explicit.
PostgreSQL18 publisher documentation opened on6November2026: §9.18 CASE/COALESCE/NULLIF. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.
- Market practice
Aggregate functions (PostgreSQL documentation) ↗ — PostgreSQL · PostgreSQL 18, §9.21 aggregates, NULL and empty input; publisher page opened6November 2026. Dialect scope explicit.
PostgreSQL18 publisher documentation opened on6November2026: §9.21 aggregates, NULL and empty input. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.
- Market practice
Constraints (PostgreSQL documentation, data definition chapter) ↗ — PostgreSQL Global Development Group · PostgreSQL 18, §5.5 CHECK/NOT NULL/UNIQUE/primary/foreign keys; publisher page opened6November 2026. Dialect scope explicit.
PostgreSQL18 publisher documentation opened on6November2026: §5.5 CHECK/NOT NULL/UNIQUE/primary/foreign keys. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.
- Market practice
SQLite: SQL expressions ↗ — SQLite project · SQLite: SQL expressions; CASE/BETWEEN/IN/EXISTS, scalar cardinality, NULL-safe equality and parameter values. Publisher page opened6November 2026.
Publisher documentation opened on6November2026. Engine/version scope is explicit; other database implementations may differ. Teaching queries are synthetic, not a required publisher template.
- Simplified educational illustration
Payments Signal editorial teaching models — Payments Signal
What this simplifies: Daily List people, data and exercises are invented for teaching. Query results belong to the declared fixture and database version. Authorization, business identity, time bounds and unknown-value policy must be agreed in context; no universal mandatory query template is implied.
Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.