August 12th, 2008

NULL

Posted by admin in C. SELECT Statement

NULL is a marker used when
the value does not exist,
the value exists but we don’t know what the value is,
the value is out of range, or
the value is not appropriate for this column.

> Null values are shown as hyphens in the result of the SELECT statement.
> If a null is returned, it means that there is no value.
> A null is not the same as a zero (0), a blank, or an empty string (”).
> When testing for a specific value in the field, the result can be: TRUE (equal), FALSE (unequal), or UNKNOWN (null).
> If someone refers to a value as being NULL, that is incorrect because null means there is no value.
> In SQL, the keyword NULL represents a null.
> A null does not belong to any data type and can be inserted into any columns that allow a null.
> The capability of not having a null is established by using the keywords NOT NULL in a CREATE TABLE column definition. This will be covered in the DDL table definition course.
> If you do not specify a NOT NULL constraint, the column will accept a null by default.
> One extra byte is used in the SQL file for each field that can have a null value, whether the field is NULL or not.
> In most table definitions, a null is not allowed. This can help data integrity because some valid value must be inserted.
> Multiple null values within a column are not considered equal.
> Null values are considered equal with SELECT DISTINCT.
> A unique index will allow only one null entry for each column.
> Null values are considered greater than or less than non-null values in the collating sequence depending on the manufacturer’s implemented sequence of your RDBMS.
> Nulls are not included in the result of column functions.
> Nulls are handled in a special way in a batch program and will be covered in batch programming.
> Oracle treats an empty string (”) as a null. This can cause conversion problems when converting to another RDBMS. Oracle may change this convention in a future release.

Comments are closed.

Sorry, the comment form is closed at this time.