Key definition

A key definition in a CREATE TABLE statement or an ALTER TABLE statement defines the key in a base table. The key definition is introduced by the keywords PRIMARY KEY.


<key_definition> ::= PRIMARY KEY (<column_name>,...)


SQL Tutorial, Primary Key


The column name column_name must identify a column in the base table. The specified column names are key columns in the table.

A key column must not identify a column of the data type LONG and is always a NOT NULL column. The database system ensures that no key column has a NULL value and that no two rows of the table have the same values in all key columns.

See also:

Restrictions for SQL Statements