Modifying Indexes

From InterBase
Jump to: navigation, search

To change an index definition—which columns are indexed, sort order, or UNIQUE requirement—you must first drop the index and then create a new index.

Image 025.jpg Altering the Namex Index

Begin by viewing the current definition of the namex index.

  1. Since namex was created on the Employee table, click Tables in the left pane of IBConsole.
  2. Double-click Employee, and in the Tutorial - Properties for: EMPLOYEE dialog, click Indexes (ShowIndexesbutton.png).
  3. Select the Metadata tab to view the definition and then you can exit this Properties dialog.

In the following steps, you redefine the namex index that you created earlier to include the UNIQUE keyword.

  1. In the ISQL enter and execute the following DROP INDEX statement:
    DROP INDEX namex
  2. Enter and execute the following line to redefine namex so that it includes the UNIQUE keyword:
    CREATE UNIQUE INDEX namex ON Employee (last_name, first_name)
  3. Once again, double-click Employee, and in the Tutorial - Properties for: EMPLOYEE dialog, click Indexes (ShowIndexesbutton.png).


  4. UniqueKeyIndex.png

    Time to back up: If you have successfully altered the Department table definition, created the phone_list view, created the three indexes, and altered the namex index, this is a good time to back up your database to Tutorial3.gbk.

Advance To:

Part III