Show TOC

 Join, Projection and SelectionLocate this document in the navigation structure


It is more understandable if we explain the join, projection and selection operators using an example. The following example shows the structure of a view with these relational operators.

There are tables TABA and TABB. Table TABA has 2 entries and table TABB has 4 entries.

You can see in the figure above that each record of TABA is first combined with each record of TABB. If a join condition is not defined, the cross product of tables TABA and TABB is displayed with the view.

Join Conditions

When the entire cross product is not a sensible selection, the cross product must be restricted with join conditions. A join condition describes how the records of the two tables are connected.

In our example, Field 1 of TABA must be identified with Field 3 of TABB. The join condition is TABA-Field 1 = TABB-Field 3 . This join condition removes all records for which the entry in Field 1 is not identical to the entry in Field 3 from the cross product. The column for Field 3 in the view is not required. In the following figure you can see the exact result from the join condition in our example.


Sometimes some of the fields of the tables involved in a view are not of interest. The set of fields used in the view can be defined explicitly (projection). In our example, Field 4 is of no interest and can be hidden. You can see the result of this projection in the following figure.

Selection Conditions

Selection conditions that are used as a filter can be defined for a view.

You can define the restrictions for the contents of the view fields in selection conditions. In this case, only the data records that satisfy these restrictions can be selected with the view. In a selection condition, the contents of a view field are compared with a constant using a comparison operator. You can link several selection conditions with the logical operators AND and OR.

In our example, only the records that have the value A in Field 4 must be displayed with the view. The selection condition is TABB-Field 4 = 'A' . You can see the result from this selection condition in the following figure.


You can formulate a selection condition with a field that is not contained in the view.

See also:

Inner Join and Outer Join