Chapter 3 Building Physical Diagrams


Defining reference joins

A join is a link between a column in a parent table and a column in a child table (column pair) that is defined within a reference.

A join can link primary key, or alternate key, and foreign key columns, or user specified columns in the parent and child tables that are independent of key columns.

Default joins at reference creation

When you create a reference, the current selections for Model Options determine the creation of the following types of default joins:

Join creation is determined by the following selections for Model Options:

Default Link on Creation Auto-migrate Columns
Result
Primary Key Selected Joins created between primary and foreign key columns
  Not selected Joins are created that are linked to primary key columns, but are incomplete. Foreign key columns must be specified manually
User-defined Selected No joins created. Parent and child table column pairs must be specified manually
  Not selected No joins created. Parent and child table column pairs must be specified manually

Linking columns in a primary or alternate key

For any reference you can choose to link a primary key, or alternate key, to a corresponding foreign key. When you select a key from the Joins page of the reference property sheet, all the key columns are linked to matching foreign key columns in the child table.

Note   Changing a foreign key column link
A foreign key column can also be changed to link to another parent table column, either within the key relationship, or independent of it.

Reuse and Migration option for a selected reference

You can use the following buttons on the Joins page to reuse or migrate columns linked by joins.

Button Name Description

Reuse Columns Reuse existing child columns with same code as parent table columns

Migrate Columns Migrate key columns to foreign key columns. If columns do not exist they are created

Cancel Migration Delete any migrated columns in child table

Auto arrange join order

The join order can be established automatically or manually by using the Auto Arrange Join Order check box. The Auto Arrange Join Order check box is grayed if the reference is not joined to a key.

Selecting or clearing the Auto arrange join order check box has the following effects:

Auto Arrange Join Order
Effect
Checked Sorts the list according to the key column order (the move buttons are not available)
Cleared Allows you to manually sort the join order with the move buttons (the move buttons are available)

Steps To define joins in a reference:

  1. Double-click a reference in the diagram to display the reference property sheet.
  2. Click the Joins tab to display the Joins page.
  3. Select a key from the Parent Key dropdown listbox to create joins between primary key, or alternate key, and foreign key columns.

    or

    Select <NONE> from the Parent Key dropdown listbox to create joins between user-specified columns. If you select <NONE>, the column lists are empty.

    The columns linked by the joins are listed in the Parent Table and Child Table columns. A Joins page with a selected Parent Key is shown below:


    Note   Changing a foreign key column linked by a join
    You can change the foreign key column linked by a join by clicking the column in the Child Table list, and selecting another column from the dropdown listbox.



  4. <Optional> If you selected <NONE> from the Parent Key dropdown listbox, click the Parent Table Column and select a column from the dropdown listbox, then click the Child Table Column and select a child column.
  5. <Optional> Select or clear the Auto arrange join order check box.

    A Joins page with a selected parent key and selected Auto arrange join order check box is shown below:


    Note   Enabling the Auto arrange join order check box
    To enable this check box, add an EnableChangeJoinOrder item to the Reference category in the DBMS definition file and set the value to YES.

  6. Click OK.

For information on adding an item to the Reference category, see chapter DBMS Reference Guide in the Advanced User Documentation .

 


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