Column constraints

Column constraints are restrictions on the data that can be inserted into a given column.

The following table describes the column constraints. Any of these constraints can be applied to any column.

Table 1. Column constraints 
Constraint Description
NOT NULL

Indicates that the column must be assigned a value.

NULL is not the same as zero or white space.

PRIMARY KEY

Denotes that the column is a primary key for the table. The primary keys can be used to join related tables in a multiple table query.

The combination of data in the PRIMARY KEY columns of a given table must be unique, although the data in each individual column does not necessarily have to be unique. For example, the primary key might comprise the multiple fields of forename, surname, and age.

The primary key is internally indexed and so provides faster query times, but slower insert and delete times. Unique and indexed fields are also internally indexed.

List and object fields cannot be indexed, thus they cannot be set as primary keys, unique fields, nor as part of an index definition.

If multiple constraints are specified for a single column, NOT NULL must be specified before PRIMARY KEY.