Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

3.2.3 Integrity constraints

HiRDB uses the following two integrity constraints to ensure the validity of a database:

Organization of this subsection
(1) NOT NULL constraint
(2) Uniqueness constraint

(1) NOT NULL constraint

The NOT NULL constraint prohibits the null value from being set in a specified column.

The NOT NULL operand of the CREATE TABLE statement is used to implement the NOT NULL constraint. Because there must always be a value in every row of a column for which the NOT NULL constraint is specified, a constraint error occurs if an attempt is made to assign the null value in the column. When a constraint error occurs, the database cannot be updated; the null value must never be set in a column for which the NOT NULL constraint is specified.

(2) Uniqueness constraint

When the uniqueness constraint is specified for a column, the value in every row of the column must be unique (no value can be duplicated in the column).

The uniqueness constraint can be specified for the following types of columns:

(a) Column defined as a cluster key

Specified with the UNIQUE operand of the CREATE TABLE statement.

For details about the cluster key specifications, see the HiRDB Version 8 Installation and Design Guide.

(b) Column for which an index is defined

Specified with the UNIQUE operand of the CREATE INDEX statement.

For details about the CREATE TABLE and CREATE INDEX specifications, see the manual HiRDB Version 8 SQL Reference.