Managing Primary Keys

A primary key constraint designates a column as the primary key of a table or view. A composite primary key designates a combination of columns as the primary key. A primary key combines a Not Null and unique constraint in one declaration. Therefore, to satisfy a primary key constraint, no primary key value can appear in more than one row in the table, and no column that is part of the primary key can contain Null. A table or view can have only one primary key.

Creating Primary Keys

  1. Open a table and select New Primary Key on the dbForge Table menu.
  2. Add required columns to the key and click OK. You can also switch to the Constraints tab and create the primary key within the shortcut menu.

Editing Primary Keys

  1. Navigate to the key in Database Explorer and double-click it or open the table that owns the primary key.
  2. Switch to the Constraints tab and choose Edit Constraint on the shortcut menu.

Dropping Primary Keys

  1. Navigate to the key in Database Explorer.
  2. Select Delete on the shortcut menu.

    -or-

  3. Open the table that owns the primary key.
  4. Switch to the Constraints tab.
  5. Select Delete Constraint on the key shortcut menu.