G-3200: Avoid using an ON clause when a USING clause will work.

Minor

Maintainability

Reason

An on clause requires more code than a using clause and presents a greater possibility for making errors. The using clause is easier to read and maintain.

Note that the using clause prevents the use of a table alias for the join column in any of the other clauses of the sql statement.

Example (bad)

1
2
3
4
5
select e.deparment_id
      ,d.department_name 
      ,e.last_name 
      ,e.first_name 
  from employee e join department d on (e.department_id = d.department_id);

Example (good)

1
2
3
4
5
select department_id
       dept.department_name 
      ,emp.last_name 
      ,emp.first_name 
  from employee emp join department dept using (department_id);