Joins Based on Equality

There are two kinds of joins that use the “equal to” operator:

  • Equijoins

  • Natural joins

The equijoin is useful when you're first working with joins. It displays the join column from each table and allows you to see how the join works. Natural joins eliminate the duplication and are much more common.

SQL VARIANTS

Transact-SQL also provides the operators !=, !>, and !<, which are equivalent to <>, <=, and >=, respectively.

Equijoins

By definition, an equijoin joins on matching values and displays the join's seam—the connecting column from each table that participates in the join.

This query finds titles that are connected to orders with a particular sales order number:

SQLSQL
select title, t.title_id,      select title, t
.title_id ...

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.