Logical and Arithmetic Operations on Nulls | VantageCloud Lake - Logical and Arithmetic Operations on Nulls - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Nulls are not valid as predicate conditions in SQL other than for the unique example of CASE expressions.

You cannot solve for the value of a null because, by definition, a null has no value. For example, the expression value = NULL has no meaning and therefore can never be true (however, see Null Sorts as the Lowest Value in a Collation for a counterexample). A query that specifies the predicate WHERE value = NULL can never be true or false and is therefore invalid. The meaning of the comparison the predicate specifies is not only unknown, but unknowable.

If you want to search for fields that do or do not contain nulls, you must use the operators IS NULL or IS NOT NULL (see Searching for Nulls Using a SELECT Request, Excluding Nulls from Query Results and Searching for Nulls and Nonnulls in the Same Search Condition).

The difference is that when you use a mathematical operator like equal (=), you specify a comparison between values or value expressions, whereas when you use the IS NULL or IS NOT NULL operators, you specify an existence condition. Although IS NULL and IS NOT NULL return truth values, their operands are not truth values. Therefore, IS NULL and IS NOT NULL are not logical operators and do not count against the number of possible logical operators for a trivalent logic calculated in Number of Logical Operators Supported for Bivalent and Trivalent Logics.