Using Iq Unique Constraint On Columns; Using Check Conditions On Columns - Sybase Adaptive Server IQ 12.4.2 Administration And Performance Manual

Table of Contents

Advertisement

Using table and column constraints

Using IQ UNIQUE constraint on columns

Using CHECK conditions on columns

Example 1
Example 2
278
The
constraint specifies an estimate of the number of distinct
IQ UNIQUE
values in a column. You can apply the
a table. This constraint helps optimize loading of indexes.
For example, in the
state
to indicate that there are only 50 possible values (assuming U.S.
UNIQUE(50)
states only). Each of the possible values can occur many times.
You can use a CHECK condition to specify that the values in a column must
satisfy some definite criterion.
You can apply an unenforced CHECK condition to values in a single column,
to specify the rules they should follow. These rules may be rules that data must
satisfy in order to be reasonable, or they may be more rigid rules that reflect
organization policies and procedures.
CHECK conditions on individual column values are useful when only a
restricted range of values are valid for that column. Here are some examples:
You can specify a particular formatting requirement. If a table has a column for
phone numbers you can specify that they all be entered in the same manner. For
North American phone numbers, you could use a constraint such as the
following:
ALTER TABLE customer
MODIFY phone
CHECK ( phone LIKE '(___) ___-____' ) UNENFORCED
The keyword
Note
UNENFORCED
You can specify that the entry should match one of a limited number of values.
For example, to specify that a
of allowed cities (say, those cities where the organization has offices), you
could use a constraint like the following:
ALTER TABLE office
MODIFY city
CHECK ( city IN ( 'city_1', 'city_2', 'city_3' ) )
UNENFORCED
IQ UNIQUE
column of the
employee
must appear after every
column only contains one of a certain number
city
constraint to any column in
table, you would specify
condition.
CHECK
IQ

Advertisement

Table of Contents
loading

Table of Contents