Skip to content
>devspeak
← glossary
level 4Databases

Null

also: non-null, not null, nullable, null value, nulls

A special value meaning "nothing here" or "unknown". It's different from zero or blank text: it means no value was stored at all.

a bit more technical

A marker for a missing or unknown value. In SQL, NULL isn't equal to anything, even another NULL, so checks need IS NULL. A NOT NULL constraint forbids it; a "nullable" column allows it. Most programming languages have a similar null value.

picture it

A blank answer on a survey versus writing "0". Zero is an answer. A blank means nobody knows: maybe they skipped it, maybe it didn't apply.

why it matters

Many crashes come from code expecting a value that turns out to be null. And when you make a field required, every existing record needs a value, which is why non-null changes often break migrations.

what your agent might say
agent
The page crashes because user.avatar_url is null for accounts created before profile photos existed. I'll show a default image when it's missing.
how you might use it
you → your agent
Make phone_number required going forward. First tell me how many existing customers have it as null and what value they should get.
common mistake

Treating null as zero or an empty string. Zero is a number and empty text is still text. Null means no value was stored.

builds on