Joins with USING






Joins with USING

If the names of the join columns are equal, USING can also be used instead of the condition. Therefore, the following two FROM clauses are equal:

FROM      TEAMS INNER JOIN PLAYERS
          ON TEAMS.PLAYERNO = PLAYERS.PLAYERNO

and

FROM      TEAMS INNER JOIN PLAYERS
          USING (PLAYERNO)

The use of USING has no influence on the result and does not create any additional possibilities with respect to the other form. It has only two limited advantages. First, the statement is a little shorter and, therefore, easier to read. Second, when a join of two or more columns must be specified, the formulation becomes much more compact.

Portability

USING is supported by most SQL products, but not all. For example, DB2 does not support it.




 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows