Constraints
An SQL constraint is an object that protects the integrity of data in a table by specifying a condition
that all the values in a particular column or set of columns of the table must satisfy.
Neoview SQL enforces these constraints on SQL tables:
CHECK
NOT NULL
PRIMARY KEY
Creating, Adding, and Dropping Constraints on SQL Tables
To create constraints on an SQL table when you create the table, use the CHECK, NOT NULL,
or PRIMARY KEY, clauses of the CREATE TABLE statement.
For more information on Neoview SQL commands, see
and
"ALTER VIEW Statement" (page
Constraint Names
When you create a constraint, you can specify a name for it or allow a name to be generated by
Neoview SQL. You can optionally specify both column and table constraint names. Constraint
names are two-part logical names. Constraints have their own namespace within a schema, so
a constraint name can have the same name as a table, index, or view. However, no two constraints
in a schema can have the same name.
The name you specify can be fully qualified or not. If you specify the schema parts of the name,
they must match those parts of the affected table and must be unique among constraint names
in that schema. If you omit the schema portion of the name you specify, Neoview SQL expands
the name by using the schema for the table.
If you do not specify a constraint name, Neoview SQL constructs an SQL identifier as the name
for the constraint and qualifies it with the schema of the table.The identifier consists of the table
name concatenated with a system-generated unique identifier.
Column or table constraint specifying a condition must
be satisfied for each row in the table.
Column constraint specifying the column cannot contain
nulls.
Column or table constraint specifying the column or set
of columns as the primary key for the table.
"CREATE TABLE Statement" (page 69)
51).
Constraints
193