Manage Index or Primary Key
This window is used for creating, displaying and altering indexes and primary keys. It is one of the forms of the Manage Object window. That section gives general information about this window, including the use of the buttons and menu items.
This window is part of the Administration Component of AQT.
You can activate this window in the following ways:
- from the Database Explorer, click on Create, Properties of or Alter of an Index or Primary Key.
- from the Manage Table window, click on New from the Index or Primary Key tabs.
The window consists of two parts:
- general parameters of the index / primary key
- index columns
General Properties of the Index / Primary Key
This shows you the miscellaneous properties of the index or primary key. These will include:
- Table. This specifies the table which the index / primary key is based on. Use the Browse (. . . ) button to select the table.
- Unique. This specifies whether the index is unique or not.
You may see other properties here, depending on your database type.
Index Columns
You use the Index Columns to specify the columns in your index or primary key.
- On the left will be a list of the columns in your table, on the right is a list of the columns in your index or primary key.
- Specify that a column is to part of the index column list by either double-clicking it, or selecting it then clicking on the > button.
- Remove a column from the index column list by either double-clicking it, or selecting it then clicking on the < button.
- Change the order of the columns in the index column list by dragging them up or down.
- For indexes you can specify whether an index column is going to be an Ascending or Descending Index. This can not be specified for a primary key, for which the column order is not relevant.
More info on Primary Keys
- Primary Keys have a name (which you specify at the top of the window). The is often referred to as the Constraint name.
- Most databases do not allow you to create a primary key on columns that can be null. In other words, all columns in your primary key must be defined as not null.
- Almost all databases will implement the primary key by creating a unique index. This index is generally given the same name as the constraint name.
- If you want more control about how this index is created (for instance you need to specify particular parameters such as space allocation), you should create the index first, then create the primary key. Most databases will see that you already have an index of the right definition and will use this as the primary-key index, rather than creating a new one.
- Some databases (such as DB2 z/OS) will not create an index when you define the primary key. Instead, a unique index on the primary key columns must already exist before you create the primary key.