Null values
The nullability of a column determines if the rows in the table can
contain a null value for that column. A null value, or NULL, is not the
same as zero (0), blank, or a zero-length character string such as "";
NULL means that no entry has been made.
A value of NULL indicates the value is unknown. A value of NULL is different
from an empty or zero value. No two null values are equal. Comparisons
between two null values, or between a NULL and any other value, return
unknown because the value of each NULL is unknown.
In general, avoid permitting null values because they incur more complexity
in queries and updates and because there are other column options, such
as PRIMARY KEY constraints, that cannot be used with nullable columns.
If it is possible that null values may be stored in your data, it is
a good idea to create queries and data-modification statements that either
eliminate NULLs or transform NULLs into some other value (if you do not
want null values appearing in your data).
If a row is inserted but no value is included for a column that allows
null values, the database engine supplies the value NULL (unless a DEFAULT
definition or object exists). A column defined with the keyword NULL also
accepts an explicit entry of NULL from the user, no matter what data type
it is or if it has a default associated with it. The value NULL should
not be placed within quotation marks because it will be interpreted as
the character string 'NULL', rather than the null value.
Specifying a column as not permitting null values can help maintain
data integrity by ensuring that a column in a row always contains data.
If null values are not allowed, the user entering data in the table must
enter a value in the column or the table row cannot be accepted into the
database.
Note: Columns
defined with a PRIMARY KEY constraint or IDENTITY property cannot allow
null values.
Related Topics:
About data types and
column sizes
Change a column's
data type or size
About primary keys
Opening and viewing
tables and views
Delete duplicate
records from a table
Guidelines for naming objects
Tables
Views
|