Neoview SQL Reference Manual (R2.5)
NOTE: The NOT ENFORCED referential constraint (REFERENCES/FOREIGN
KEY) is used to help the optimizer eliminate redundant joins, and not to enforce
referential integrity.
ADD [CONSTRAINT constraint] table-constraint
adds a constraint to the table and optionally specifies constraint as the name for the
constraint. The new constraint must be consistent with any data already present in the table.
CONSTRAINT constraint
specifies a name for the column or table constraint. constraint must have the same
schema as table and must be unique among constraint names in its schema. If you omit
the schema portions of the name you specify in constraint, Neoview SQL expands
the constraint name by using the schema for table. See “Database Object Names” (page 242).
If you do not specify a constraint name, Neoview SQL constructs an SQL identifier as the
name for the constraint in the schema for table. The identifier consists of the fully qualified
table name concatenated with a system-generated unique identifier. For example, a
constraint on table A.B.C might be assigned a name such as A.B.C_123..._01... .
table-constraint options:
CHECK (condition)
is a constraint that specifies a condition that must be satisfied for each row in the
table. See “Search Condition” (page 305). 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.
DROP CONSTRAINT constraint [RESTRICT]
drops a constraint from the table.
If you drop a constraint, Neoview SQL drops its dependent index if Neoview SQL originally
created the same index. If the constraint uses an existing index, the index is not dropped.
CONSTRAINT constraint
specifies a name for the column or table constraint. constraint must have the same
schema as table and must be unique among constraint names in its schema. If you omit
the schema portions of the name you specify in constraint, Neoview SQL expands
the constraint name by using the schema for table. See “Database Object Names” (page 242).
If you do not specify a constraint name, Neoview SQL constructs an SQL identifier as the
name for the constraint in the schema for table. The identifier consists of the fully qualified
table name concatenated with a system-generated unique identifier. For example, a
constraint on table A.B.C might be assigned a name such as A.B.C_123..._01... .
RENAME TO new-name[CASCADE]
changes the logical name of the object within the same schema.
ALTER TABLE Statement 47