In this lesson, you will add indexes to both the salesdata and warehouse_inventory tables in a database model. Before you begin, complete “Lesson 2: Adding tables to the model”.
Double-click the salesdata table in the editor.
Select the Indexes tab in the Table Properties dialog box.
Click the first blank line in the index list. An arrow appears to the left of the line; a default index name and code also appear.
Overwrite the default name and enter the salesdata_pk
in
the Name field. After you enter the index Name,
it automatically appears in the Code field.
Click Apply.
Add columns to each index for the table. Select
the salesdata_pk
line, and
double-click the arrow to the left of the salesdata_pk
line.
When the Index Properties page opens, select the Columns tab, which currently contains no columns.
The Columns definition list box shows the primary and alternate keys defined for the table. When you select a key in the Columns definition list box, that key’s columns display in the list.
Select PK: Key_1 from the Columns definition drop-down list.
The primary-key column appears in the list.
Click Apply.
Click OK on the Index Properties page to return to the Table Properties page. The P option is selected on the line in the index list, indicating that the indexed column is a primary-key column.
Click OK on the Table Properties sheet to return to the table diagram in the Physical Data Model editor.
Now, add an index for the warehouse_inventory table.
Double-click the warehouse_inventory table in the editor.
Select the Indexes tab in the Table Properties dialog box.
Click the first blank line in the index list.
Overwrite the default name and enter warehouse_inventory_pk
in
the Name field.
Click Apply. Now, add columns to each index for the table.
Click the warehouse_inventory_pk
line
to select it.
Double-click the arrow to the left of the warehouse_inventory_pk
line.
When the Index Properties page opens, select the Columns tab, which currently contains no columns.
The Columns definition list box shows the primary and alternate keys defined for the table. When you select a key in the Columns definition list box, that key’s columns display in the list.
Select PK: Key_1 from the Columns definition list box. The primary-key column appears in the list.
Click Apply.
Click OK on the Index Properties page to return to the Table Properties page. The P option is selected on the line in the index list, indicating that the indexed column is a primary-key column.
Click OK on the Table Properties sheet to return to the table diagram in the Physical Data Model editor.
Select File|Save from the WorkSpace main menu bar. You have finished adding indexes to the salesdata and warehouse_inventory tables in the database model.