This topic describes how to create and manage keys from Database Explorer.
A unique constraint ensures that the values in a column—or in a combination of columns (a composite unique key)—are not duplicated.
NULL values.NULL in all key columns automatically satisfies the constraint. However, two rows that share the same values in non-null columns and contain NULL in one or more key columns violate the constraint.A primary key constraint identifies a column or set of columns as the primary key of a table or view. A composite primary key uses multiple columns. A primary key combines unique and NOT NULL constraints:
NULL values.Note
In a composite primary key, each column that participates in the key must be defined as
NOT NULL. Nullable columns are not allowed.
When working with unique and primary keys, follow these rules:
LOB, LONG, VARRAY, NESTED TABLE, and REF, aren’t supported for primary or unique keys.1. In Database Explorer, right-click the Keys node and select New Foreign Key.
2. On the Constraints tab of Table Designer:
2.1. Right-click the grid and select Add Foreign Key.
2.2. Configure the foreign key properties.
3. Click Apply Changes.
1. In Database Explorer, right-click the Keys node and select New Primary Key.
2. On the Constraints tab of Table Designer:
2.1. Right-click the grid and select Add Primary Key.
2.2. Configure the primary key properties.
3. Click Apply Changes.
1. In Database Explorer, right-click the Keys node and select New Unique Key.
2. On the Constraints tab of Table Designer:
2.1. Right-click the grid and select Add Unique Key.
2.2. Configure the unique key properties.
3. Click Apply Changes.
1. In Database Explorer, right-click the key you want to edit (primary, foreign, or unique) and select Edit Primary Key, Edit Foreign Key, or Edit Unique Key.
2. On the Constraints tab of Table Designer, update the key properties.
3. Click Apply Changes.
1. In Database Explorer, right-click the key you want to delete and select Delete, or press Delete.
2. Click Yes to confirm deleting the key, or No to discard the operation.
1. In Database Explorer, right-click the key you want to rename and select Rename, or press F2.
2. Enter the new key name.
3. Click Yes to confirm the renaming of the key.
View the key properties in one of these ways:
Object Viewer opens, displaying detailed information about the key.
To update the key to reflect the latest changes, in Database Explorer, right-click the key or Keys node and select Refresh, or press F5.
To open the Properties pane, in Database Explorer, right-click the key and select Properties, or press F4.
1. In Database Explorer, right-click the Keys node and select Filter.
2. In the Filter Settings dialog, configure the filter parameters.
3. Click OK.
Note
When you expand the Keys node, the number of objects it contains appears in parentheses next to the node name. This number changes based on your filter settings.