SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
N-7
Null Values
This example evaluates to true if the expression (PRICE + TAX) evaluates to null:
(PRICE + TAX) IS NULL
This example evaluates to true if the value in :JOBCODE is not null:
:JOBCODE IS NOT NULL
This example finds all rows where both FIRST_NAME and SALARY have a null
value:
FIRST_NAME, SALARY IS NULL
Null Values
A null value is a special symbol, independent of data type, that represents an unknown
or inapplicable value. A null value indicates that an item has no value. For sorting
purposes, SQL considers null values greater than all other values.
You cannot store a null value in a column, either with INSERT or UPDATE, unless the
column was declared to allow null values when it was created.
Any row of a column that allows null values can be empty. In SQL, a column that
allows null values has two extra bytes associated with it in each row. A -1 stored in
those two bytes indicates that the column has a null value for that row; a 0 indicates a
null value.
Using Null Values Versus Default Values
Various scenarios exist in which a row in a table might contain no value for a specific
column. For example:
A database of telemarketing contacts might have AGE fields empty if contacts did
not give their age.
An order record might have a DATE_SHIPPED column empty until the order is
actually shipped.
An employee record for an international employee might not have a social security
number.
You allow null values in a column when you want to convey that a value in the column
is either unknown (such as the age of a telemarketing contact) or not applicable (such
as the social security number of an international employee).