Specifying a predicate

You specify a predicate (for example EMPNO = '000010') by typing the comparison operator (=) in the Op field, and the comparison value (000010) in the Value field. To specify a join predicate, include the correlation reference for the table containing the join column in the value field.

For example, to specify a join between DSN81010.EMP.WORKDEPT and DSN81010.DEPT.DEPTNO:

  • Type = in the Op field for column WORKDEPT.
  • Type T2.DEPTNO in the Value column for WORKDEPT.

Specifying a join predicate shows an example of specifying the join, and The result of the join predicate shown in the previous figure shows the result of the join predicate.

Figure 1. Specifying a join predicate
Process   Options   Utilities   Help
────────────────────────────────────────────────────────────────────────────────
 FM/Db2 (DFG2)              Basic SELECT Prototyping                Row 1 of 19

 SELECT T1.*
   FROM "DSN81010"."EMP" T1
   WHERE ?
   ORDER BY ?

 Row count  100            Number of rows to display

 Select columns (S/A/D) or enter predicates to build the SELECT statement:

 S LOp ( Tab Column Name      + Data Type(length)  + Op Value                 )
          T1 EMPNO              CHAR(6)                                        
          T1 FIRSTNME           VARCHAR(12)                                    
          T1 MIDINIT            CHAR(1)                                        
          T1 LASTNAME           VARCHAR(15)                                    
          T1 WORKDEPT           CHAR(3)              =  T2.DEPTNO              
          T1 PHONENO            CHAR(4)                                        

 Command ===>                                                       Scroll PAGE
  F1=Help      F2=Split     F3=Exit      F6=Execute   F7=Backward  F8=Forward
  F9=Swap     F12=Cancel
Figure 2. The result of the join predicate shown in the previous figure
Process   Options   Utilities   Help
────────────────────────────────────────────────────────────────────────────────
 FM/Db2 (DFG2)              Basic SELECT Prototyping                Row 1 of 19

 SELECT T1.*
   FROM "DSN81010"."EMP" T1 "DSN81010"."DEPT" T2
   WHERE "WORKEDPT" = T2.DEPTNO
   ORDER BY ?

 Row count  100            Number of rows to display

 Select columns (S/A/D) or enter predicates to build the SELECT statement:

 S LOp ( Tab Column Name      + Data Type(length)  + Op Value                 )
          T1 EMPNO              CHAR(6)                                        
          T1 FIRSTNME           VARCHAR(12)                                    
          T1 MIDINIT            CHAR(1)                                        
          T1 LASTNAME           VARCHAR(15)                                    
          T1 WORKDEPT           CHAR(3)                                        
          T1 PHONENO            CHAR(4)                                        

 Command ===>                                                       Scroll PAGE
  F1=Help      F2=Split     F3=Exit      F6=Execute   F7=Backward  F8=Forward
  F9=Swap     F12=Cancel