Join operators

Joins that match columns on the basis of equality are called equijoins. A more precise definition of an equijoin is given under “Equijoins and natural joins”, along with examples of joins not based on equality.

Equijoins use the following comparison operators:

Table 4-1: Join operators

Operator

Meaning

=

Equal to

>

Greater than

>=

Greater than or equal to

<

Less than

<=

Less than or equal to

!=

Not equal to

!>

Less than or equal to

!<

Greater than or equal to

Joins that use the relational operators are collectively called theta joins. Another set of join operators is used for outer joins, also discussed in detail later in this chapter. The outer join operators are Transact-SQL extensions, as shown in Table 4-2:

Table 4-2: Outer join operators

Operator

Action

*=

Include in the results all the rows from the first table, not just the ones where the joined columns match.

=*

Include in the results all the rows from the second table, not just the ones where the joined columns match.