Online Documentation for SQL Query for DB2

Joining tables


The Builder area allows you to associate two objects by their fields: this operation is performed by dragging a field from one object list to another. This will set a link between these objects by the selected fields. It is indicated by a bidirectional arrow between the linked fields.

 

You can view the link properties of objects association: set the mouse cursor over the linking arrow, and a hint containing the association condition will popup after a short delay.

 

hs3322 - Joining tables

 

To edit the link properties, double-click the linking arrow or right-click it and select the Property popup menu item. The Link properties dialog allows you to change the association condition by choosing it from the drop-down list (=, >, <, >=, <=, <>).

 

hs3322 - Link properties

 

For your convenience the CheckBox Include all option is available for each object of the association.

 

 

If left Include all option is checked the LEFT OUTER JOIN statement will be added to the query.

If right Include all option is checked the RIGHT OUTER JOIN statement will be added to the query.

If both Include all options are checked the FUll OUTER JOIN statement will be added to the query.

If none of the include options is selected then the INNER JOIN statement will be added to the query.

 

Click OK to apply the changes you have made.

 

To remove a link between objects, right-click the linking arrow and select the Delete link popup menu item.

 

To add a point to the link line, right-click the linking arrow and select the Insert point popup menu item. Using the point you can move the link line easily. The point does not cause any changes to the query, it is only used for the diagram representation and makes visual building handy and more comprehensible.