Create a Primary Key

You can create a Primary Key as either a simple (single column) key or a complex (multiple column) key.

Access     On diagram | Right-click on Table | Features & Properties | Attributes > Columns

On the Columns and Constraints dialog, select the PK checkbox for one column (simple key) or multiple columns (complex key). A Primary Key entry is automatically added to the Constraints page, showing the columns involved in the key, both on the main display and on the Assigned Columns panel.

The PK label (PK <column name>) and operation (PK_<table name>) are also immediately added to the Table element on the diagram.

To add more columns to a complex Primary Key

In the Available Columns panel, right-click on the required column name and select the Assign column <name> option. The column name is moved to the Assigned Columns panel.

To remove columns from a complex Primary Key

In the Assigned Columns panel, right-click on the required column name and select the Unassign column <name> option. The column name is moved to the Available Columns tab.

To reorganize the columns in a Primary Key

In the Assigned Columns panel, right-click on the required column name and select either the Move column <name> Up option or the Move column <name> Down option to move the column name one place up or down.

To delete a Primary Key

On the Constraints tab, right-click on the key name and select the Delete constraint <name> option. The Primary Key is immediately removed from the Table and the Constraints tab, and each selected PK checkbox is cleared.

Notes

·You cannot delete a Primary Key simply by clearing the PK checkboxes against all columns; you must specifically delete it using the delete menu option

 

Learn more