Manage primary keys (SQL)

You can create and alter the primary key in Interactive SQL using the CREATE TABLE and ALTER TABLE statements. These statements let you set many table attributes, including column constraints and checks.

Columns in the primary key cannot contain NULL values. You must specify NOT NULL on columns in the primary key.

 To add a primary key (SQL)
  1. Connect to the database as a user with DBA authority.

  2. Execute an ALTER TABLE statement for the table on which you want to configure the primary key.

 To modify a primary key (SQL)
  1. Connect to the database as a user with DBA authority.

  2. Execute an ALTER TABLE statement to drop the existing primary key.

  3. Execute an ALTER TABLE statement to add a primary key.

 To delete a primary key (SQL)
  1. Connect to the database as a user with DBA authority.

  2. Execute an ALTER TABLE statement using the DELETE PRIMARY KEY clause.

 Example 1