Neoview SQL Reference Manual (R2.4 SP2)
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.
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 292).
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
specified in the FOREIGN KEY clause. For information about ref-spec, see REFERENCES
ref-spec NOT ENFORCED.
NOT CASESPECIFIC
is a column constraint that specifies that the column contains strings that are not case specific.
The default is CASESPECIFIC. Comparison between two values is done in a case insensitive
way only if both are case insensitive. This applies to comparison in a binary predicate, LIKE
predicate, and POSITION/REPLACE string function searches. See “Examples of CREATE
TABLE” (page 92).
CREATE TABLE Statement 77