Chapter 3 Building Physical Diagrams


Creating an index linked to a key

When you link an index to a primary key, alternate key or a foreign key, the index is automatically updated when the key column or columns are modified.

An index linked to a key is unique because it uses the same unique set of columns as the key.

Example

A table contains a compound primary key. This is a primary key designated to more than one column in a table. You create an index and link it to the primary key. If one of the primary key columns is deleted, the corresponding index associated with the column is also deleted.

Steps To create an index linked to a key:

  1. Double-click the table in the diagram to display the table property sheet.
  2. Click the Indexes tab.

    The Indexes page appears. It lists indexes associated with the table.
  3. Click a new line in the list

    or

    Click the Add a Row tool.

    An arrow appears at the beginning of the line.
  4. Type an index name and an index code.
  5. Click the Properties tool.

    or

    Double-click the arrow at the beginning of the line.

    The index property sheet opens to the General page.
  6. Type or select index properties.
  7. Click the Columns tab.

    The Columns page appears. It lists columns associated with the index. At index creation the list is empty as there are no columns yet associated with the index.
  8. Select the primary key; an alternate key, or foreign key from the Columns definition dropdown list.

    The index is linked to the selected key. The key columns associated with the index appear in the column list.

    Note   Foreign key names
    The foreign keys are represented by the name of the reference that links the parent and child columns. For example, Refr:sales_title.

  9. Select the A check box at the end of the column line, if you want index entries to be in ascending order for that column.

    or

    Clear the A check box at the end of the column line, if you want index entries to be in descending order for that column.
  10. Click OK in each of the dialog boxes.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.