Using join indexes
164
A natural join between the id columns of sales_order and sales_order_items
makes more sense. In this case, the columns with the same name should contain
matching values. The command to create a join index based on a natural join
between these two tables is:
CREATE JOIN INDEX sales_order_so_items_join
FOR sales_order NATURAL FULL OUTER JOIN
sales_order_items
Creating a join index in Sybase Central
To create a join index in Sybase Central, follow these steps.
❖ To add a join index in Sybase Central:
1 Select the Join Indexes folder in the left panel of the Sybase Central
window.
2 Double-click the Add Join Index object in the right panel to open the Join
Index editor.
3 Highlight <Unnamed> in the Name box and enter a name for the index.
4 From the Left Table Name dropdown, select a table name. Repeat for the
Right Table Name.
5 Select a Join Type from the dropdown. If you select a type other than
Natural, specify the Join Columns.
6 Click Advanced Properties to add a comment.
7 If you are only joining two tables, click Save and Commit.
8 To join more than two tables, click Add Row. In the new row that appears,
enter the next table to join in the Right Table Name column. Then click
Save and Commit.
Types of join hierarchies
Adaptive Server IQ supports two different types of join hierarchies:
• Linear joins
• Star joins
You create join indexes or ad hoc joins for both linear and star joins.