AI engineering glossary · SQL databases

What is three-valued logic?

Three-valued logic: The logic SQL uses for conditions, where the result can be true, false or unknown, because NULL makes some comparisons undecidable. A WHERE clause keeps only rows whose condition is true, dropping both false and unknown.

Level: intermediateTopic: SQL databases

Three-valued logic: an example

NULL = NULL evaluates to unknown, and NOT (unknown) is still unknown, so WHERE NOT (x = 5) silently skips rows where x is NULL.

Related terms

More SQL databases terms

Where you learn it

Three-valued logic is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.