Contents Index Character strings and quotation marks Testing a column for NULL

ASA SQL User's Guide
  Queries: Selecting Data from a Table
    The WHERE clause: specifying rows

Unknown Values: NULL


A NULL in a column means that the user or application has made no entry in that column. A data value for the column is unknown or not available.

NULL does not mean the same as zero (numerical values) or blank (character values). Rather, NULL values allow you to distinguish between a deliberate entry of zero for numeric columns or blank for character columns and a non-entry, which is NULL for both numeric and character columns.

Entering NULL 

NULL can be entered in a column where NULL values are permitted, as specified in the create table statement, in two ways:

For example, the dept_head_id column of the department table allows nulls. You can enter two rows for departments with no manager as follows:

INSERT INTO department (dept_id, dept_name)
VALUES (201, 'Eastern Sales')
INSERT INTO department
VALUES (202, 'Western Sales', null)
When NULLs are retrieved 

When NULLS are retrieved, displays of query results in Interactive SQL show (NULL) in the appropriate position:

SELECT *
FROM department
dept_id dept_name dept_head_id
100 R & D 501
200 Sales 904
300 Finance 1293
400 Marketing 1576
500 Shipping 703
201 Eastern Sales (NULL)
202 Western Sales (NULL)

Testing a column for NULL
Properties of NULL

Contents Index Character strings and quotation marks Testing a column for NULL