Background documentationKey Definition (key_definition) Locate this document in the navigation structure

 

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

Structure

Syntax Syntax

  1. <key_definition> ::=
      PRIMARY KEY (<column_name>,...)
End of the code.
Examples

SQL Tutorial, Primary Key

Explanation

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 LOB 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.