NexusDB Manual V3 > SQL Reference > SQL Language Elements
|
SQL uses a special value, the null value, to indicate that a data element does not have a value. Every data element, such as table columns, variables, parameters, value expressions, the result of functions, etc., can have a null value. An exception to this rule are columns with the NOT NULL constraint, which prohibits columns from containing the null value in any row.
The null value is different from any valid value, and is therefore not the same as zero, blanks or an empty string. This concept is often confusing to programmers more familiar with programming languages like C and Pascal that define a "null string" to mean a string with length 0. In SQL, an empty string is a known value (it has no characters), while null is an unknown value.
SQL provides the keyword NULL to represent a null value in SQL statements. However, since the keyword does not associate a data type with the null value, SQL also provides a syntactic ability to associate a data type with the null value by using an explicit cast:
CAST( NULL AS data-type )
As a consequence of the null value concept, SQL uses a three-valued logic (TRUE, FALSE, UNKNOWN) when evaluating boolean expressions.
The main characteristics of the null value are summarized below:
Conformance
|
© Nexus Database Systems Pty Ltd.