Viewing Key Constraints Print this Topic Previous Page Up One Level Next page

Home >  Exploring and Changing the Database Structure > Viewing Table Structure >

Viewing Key Constraints

When you expand the Keys sections, the key constraints that have been defined for the table are displayed in such a way that each column forming part of a particular key is shown in a row of its own. For foreign keys, there is an additional column where the column that is referenced in another table is displayed.


The type of a key constraint is indicated with icons. The following icons are used:



Primary key

This constraint is the primary key of the table. The primary key ensures that no duplicate data and no NULL values can be inserted into the respective column(s). Only one primary key is allowed in a table.


Unique key

This constraint makes sure that the values entered in a specific column not participating in a primary key are unique. Multiple unique keys can be defined on a table and the NULL value is allowed in the respective table(s). Note, however, that the value NULL can only occur once per column. A unique key can be referenced by a foreign key.


Foreign key

This constraint creates a foreign key relation where the primary or unique key of a table is referenced by a column in a different table. The primary key column or unique key column, respectively, in the first table is used as a foreign key in the referencing column of the second table. This way, the foreign key ensures that only data that is present in the primary or unique key column of the first table can be inserted into the second table.


You can rename a key constraint, change, add, or remove columns, or modify the reference of a foreign key directly in the table design.


To view the properties of a key constraint in detail, select a key constraint and view the properties in the Properties window.

© 2019 Altova GmbH