NULL means unknown

In the context of a database, if a column is set to NULL, it effectively means that value is unknown. If we compare any other value with NULL, the result of that comparison is also unknown. In other words, a value can never be equal to NULL as NULL is the absence of a value. This means the ColumnValue = NULL expression will never evaluate to true or false; even if ColumnValue is in fact NULL, it will always evaluate to unknown. To detect whether a column value is NULL, we must use the IS NULL or IS NOT NULL special expressions rather than = or <>.

This handling of NULL is not unique to SQL Server, it is based on the ANSI standard handling of NULL values.

Having NULL values in our database is not an anti-pattern in and of ...

Get Learn T-SQL Querying now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.