SQL NULL vs empty string: filters that match
To find missing SQL values, use IS NULL. An empty string is different: it’s a text value with zero characters. If a filter keeps missing the rows you expect, check which of those values the column actually contains.
Try a small read-only example
You can try this example in PostgreSQL or SQLite. Its sample rows live inside the query; it creates no persistent table.
WITH sample(id, note) AS (
VALUES (1, NULL), (2, ''), (3, 'null'), (4, 'ready')
)
SELECT id, note,
note IS NULL AS is_missing,
note = '' AS is_empty
FROM sample
ORDER BY id;
Row 1 is missing. Row 2 is empty text. Row 3 contains the four letters “null.” A database grid may make these look similar, so inspect the value and the predicate rather than relying on appearance.
Write the filter you mean
Use WHERE note IS NULL for missing values and WHERE note = '' for empty strings. Ordinary comparisons with NULL produce unknown rather than true. Consequently, WHERE note <> 'ready' does not also select the missing row. Include OR note IS NULL if that is your intended rule. PostgreSQL documents this in comparison predicates.
Define the meaning before cleaning data
For a support note, empty text might mean a user deliberately cleared the field; NULL might mean no note was ever captured. For another application, those states may be equivalent. Decide with the application's owner before replacing one with the other. Spaces are another separate case: an apparently blank field can contain whitespace.
Create a small fixture like the one above for your actual business rule. List the IDs that should match, run the predicate, and compare results. This is easier to review than a large cleanup statement whose meaning depends on a vague idea of “blank.”
Preserve the distinction when exporting
A receiving CSV parser needs a documented way to distinguish missing and empty fields. Inspect the export settings and test a file containing both. Reimport into a disposable table and compare the values before moving an important dataset. In plainDB, also check whether the export covers the loaded rows or all matching rows on your platform.
Continue reading
Export CSV carefully · Review table edits
For the desktop workflow, compare plainDB features on Mac and Windows or download the 14-day trial.