Joining data with the USING clause

 

You can use the USING clause for a shorthand way of defining join conditions. The USING clause is equivalent to a join condition where each column from the left table is compared to a column with the same name in the right table.

For example, look at the USING clause in this statement:

SELECT EMPNO, ACSTDATE       FROM CORPDATA.PROJACT INNER JOIN CORPDATA.EMPPROJACT       USING (PROJNO, ACTNO)
      WHERE ACSDATE > '1982-12-31';

The syntax in this statement is valid and equivalent to the join condition in the following statement:

SELECT EMPNO, ACSTDATE       FROM CORPDATA.PROJACT INNER JOIN CORPDATA.EMPPROJACT            ON CORPDATA.PROJACT.PROJNO = CORPDATA.EMPPROJACT.PROJNO AND
              CORPDATA.PROJACT.ACTNO = CORPDATA.EMPPROJACT.ACTNO       WHERE ACSTDATE > '1982-12-31';

 

Parent topic:

Inner join