You can have more than one table describing properties of the same set of entities. For example, the Employee Table shows the number of the department to which an employee is assigned, and the Department Table shows which manager is assigned to each department number. To retrieve both sets of properties simultaneously, you can join the two tables on the matching columns, as shown in the following example. The value in WORKDEPT and DEPTNO represent the same entity and represent a join path between the DEPARTMENT and EMPLOYEE tables.
Figure 15. A Join Path between Two Tables
The DEPARTMENT table:
The EMPLOYEE table:
When you retrieve information about an entity from more than one table, make sure equal values represent the same entity. The connecting columns can have different names (like WORKDEPT and DEPTNO in the previous example), or they can have the same name (like the columns called DEPTNO in the department and project tables).
[ DB2 List of Books | Search the DB2 Books ]