Next Previous Up Top Contents Index

1.8 Database introspection

1.8.1 Database objects and integrity constraints

You can interrogate schema and table database objects for a collection of constraints defined against them. A constraint is a data integrity rule which the DBMS enforces at all times. These constraints are unique, primary key, referential and check.

The unique constraint specifies that one or more columns within a table must have a unique value or set of values for each record in the table (however, the set of columns are not necessarily a key). The primary key constraint is similar to the unique constraint, except the set of columns must uniquely identify records within the table.

The referential constraint specifies the relationship between a column or a group of columns in one table to another table; this constraint also specifies the action to take when records within the table are updated or deleted.

Finally, the check constraint is a general constraint on a table which must never be false and, due to three-valued logic, an unknown or null value will satisfy the constraint.

An assertion is a constraint on a schema. It is similar to the check constraint but it normally involves more than one table. The significant difference between an assertion and a check is that an assertion must always be true, whereas a check must never be false.

The nullability of a column is a column constraint which can be determined by introspection on the desired column.

Syntactically, SQL-92 supports table and column constraints; semantically, however, all constraints are enforced at the table level.


OLE, COM, ActiveX and DBMS Reference - 31 MAR 2000

Next Previous Up Top Contents Index