Analyzing a Join

The join operator, which expresses the relationship between the join columns, can be any of the relational operators. Equality is the most common (in which a value in the join column from one table is equal to a value in the join column from another table). For example, if an author calls to ask which editors live in the same city as a publisher's home office, a join query can provide the answer. The following query finds the names of editors who live in the same city as Algodata Infosystems:

SQL
select ed_lname, ed_id, editors.city, pub_name, publishers.city
from editors, publishers
where editors.city = publishers.city and pub_name = 'Algodata Infosystems' ed_lname ed_id city pub_name 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.