Avoiding Duplication

You don't have to name both join columns in the SELECT list, or even include the join columns in the results at all, in order for the join to succeed. Note that you may need to qualify the name of a join column with its table name in the SELECT list or in the join specification if there is any ambiguity about which column you mean. In the following query, the tables join on editors.city and publishers.city, and both city columns are included in the SELECT list.

SQL
select ed_lname, editors.city, publishers.city
from editors, publishers
where editors.city = publishers.city
and pub_name = 'Algodata Infosystems'
SQL
select ed_lname, editors.city, publishers.city
from editors join publishers
on editors.city = publishers.city ...

Get Practical SQL Handbook, The: Using SQL Variants, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.