|
Category: ASE
NULL Properties, Nullable Columns
NULL
defines the
columns
of a
table
which can contain NULL
values.
This is also called nullabilty of a column.
These columns are then called nullable columns.
Practical Meaning of Nullable Columns
If a new
data set
is inserted into a table,
and the inserted data does not declare any value for a column which has been defined with a NULL attribute, then this data field is set to NULL.
If a column was defined with the attribute "NOT NULL", a value must be provided in
insert
or
update
statements. If this is not the case an error message will be returned. The same is true if no attributes have been defined for columns.
Usage of NULL When Creating Tables
Columns of tables can be declared with NULL if the future values are unknown and will be inserted at a later point in time. Columns should be declared with NULL only if essentially necessary. It is preferable to declare a default value.
Example for a NULL Property Column
In the following example, a table with two columns will be created.
The column column_name_a NULL values can be inserted, but not in column column_name_b.
create table your_table
(
column_name_a int NULL
, column_name_b int NOT NULL
)
create table.
|