Data integrity overview
276
These and other table and column constraints are discussed in “Using table and
column constraints”. Column constraints can be inherited from user-defined
data types.
Entity and referential
integrity
The information in relational database tables is tied together by the relations
between tables. These relations are defined by the primary keys and foreign
keys built into the database design. The following integrity rules define the
structure of the database:
• Entity integrity Keeps track of the primary keys. It guarantees that
every row of a given table can be uniquely identified by a primary key that
guarantees no nulls. Adaptive Server IQ enforces single-column primary
keys only; it does not enforce multi-column primary keys.
• Referential integrity Keeps track of the foreign keys that define the
relationships between tables. All foreign key values either should match a
value in the corresponding primary key or contain the NULL value if they
are defined to allow NULL. Adaptive Server IQ does not enforce foreign
keys, however.
For more information about referential integrity, see “Declaring entity and
referential integrity”.
SQL statements for implementing integrity constraints
The following SQL statements are used to implement integrity constraints:
• CREATE TABLE statement This statement is used to implement
integrity constraints as the database is being created.
• ALTER TABLE statement This statement is used to add integrity
constraints, or to delete constraints, from an existing database.
For full descriptions of the syntax of these statements, see “SQL Statements”
in Adaptive Server IQ Reference Manual.