Fujitsu 5.0L10 Server User Manual


 
NOT NULL constraint:
Specify this constraint when NULL is not permitted as column data. Specify NOT NULL.
Unique constraint:
Specify this constraint when duplicate values are not permitted as column data. Specify UNIQUE or PRIMARY
KEY.
The unique constraint is detailed later on.
A sample column definition for the ITMNO column of the STOCK table follows. The following conditions are assumed
for ITMNO:
· ITMNO is an integer having up to eight digits.
· ITMNO is unique for each product, and a row of the STOCK table is uniquely identified by ITMNO.
· A row cannot be inserted unless an ITMNO value is entered.
Example:
Sample column definition for the ITMNO column of the STOCK table
Column comment definition
A comment consisting of a character string can be specified for a column. A character string of up to 256 bytes can be
specified. If no comment is necessary, omit the specification. An example follows.
Example:
Specify a comment for the ITMNO column in the STOCK table.
Unique constraint
The unique constraint can be specified as a constraint for a group of several columns within a table. This type of
specification is called a table constraint. A unique constraint can also be specified as a column constraint for a single
column of a table.
With a unique constraint specification, the specified column or group of columns cannot have the same value or group
of values in more than one row. The value of the specified column or values of the group of columns are determined
uniquely within the table. The unique constraint is specified by UNIQUE or PRIMARY KEY.
UNIQUE
Specify UNIQUE in the following situation. The table is not permitted to have more than one row with the same value
or values for the specified column or group of columns. The specification format is as follows.
NOT NULL must already be specified in the column definition for any column for which UNIQUE is specified.
The next example defines the STOCK table with the constraint that two or more rows cannot have identical values in
both the ITMNO and PRODUCT columns.
39