SAND CDBMS SQL Reference Guide
Constraints

 

A constraint is a restriction on the possible values that a column or table can contain. Constraints are used to maintain the data integrity of the database by ensuring the consistency and correctness of its stored data.

There are two general categories of constraints: column constraints and table constraints. Column constraints are constraints defined on a single column, while table constraints are defined on one or more columns in a table.

Both types of constraints can be defined in a CREATE TABLE statement. A column constraint may also be set on a new column when the column is added to a table through an ALTER TABLE...ADD COLUMN statement. A table constraint may be defined on an existing table via the ALTER TABLE...ADD CONSTRAINT command.


Topics: