HP Neoview SQL Reference Manual page 77

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

REFERENCES ref-spec NOT ENFORCED
specifies a REFERENCES column constraint. The maximum combined length of the columns
for a REFERENCES constraint is 2048 bytes.
ref-spec is:
referenced-table [(column-list)]
referenced-table is the table referenced by the foreign key in a referential constraint.
referenced-table cannot be a view. referenced-table cannot be the same as
table. referenced-table corresponds to the foreign key in the table.
column-list specifies the column or set of columns in the referenced-table that
corresponds to the foreign key in table. The columns in the column list associated with
REFERENCES must be in the same order as the columns in the column list associated
with FOREIGN KEY. If column-list is omitted, the referenced table's PRIMARY KEY
columns are the referenced columns.
A table can have an unlimited number of referential constraints, and you can specify the
same foreign key in more than one referential constraint, but you must define each
referential constraint separately. You cannot create self-referencing foreign key constraints.
NOT ENFORCED is required.
NOTE:
The NOT ENFORCED referential constraint (REFERENCES/FOREIGN KEY) is
used to help the optimizer eliminate redundant joins, and not to enforce referential
integrity.
PRIMARY KEY [ASC[ENDING] | DESC[ENDING]] or PRIMARY KEY (key-column-list)
is a column that specifies a column or set of columns as the primary key for the table.
key-column-list cannot include more than one occurrence of the same column.
ASCENDING and DESCENDING specify the direction for entries in one column within the
key. The default is ASCENDING.
The PRIMARY KEY value in each row of the table must be unique within the table. A
PRIMARY KEY defined for a set of columns implies that the column values are unique and
not null. You can specify PRIMARY KEY only once on any CREATE TABLE statement.
Neoview SQL uses the primary key as the clustering key of the table in order to avoid creating
a separate, unique index to implement the primary key constraint.
A PRIMARY KEY constraint is required in Neoview SQL.
CHECK (condition)
is a constraint that specifies a condition that must be satisfied for each row in the table. See
"Search Condition" (page
You cannot refer to the CURRENT_DATE, CURRENT_TIME, or CURRENT_TIMESTAMP
function in a CHECK constraint, and you cannot use subqueries in a CHECK constraint. For
information about the CHECK constraint and string literals, see the Neoview Character Sets
Administrator's Guide.
FOREIGN KEY (column-list) REFERENCES ref-spec NOT ENFORCED
is a column or table constraint (respectively) that specifies a referential constraint for the
table, declaring that a column or set of columns (called a foreign key) in table can contain
only values that match those in a column or set of columns in the table specified in the
REFERENCES clause. However, since NOT ENFORCED is specified, this relationship is not
checked.
The two columns or sets of columns must have the same characteristics (data type, length,
scale, precision). Without the FOREIGN KEY clause, the foreign key in table is the column
being defined; with the FOREIGN KEY clause, the foreign key is the column or set of columns
305).
CREATE TABLE Statement
77

Advertisement

Table of Contents
loading

Table of Contents