Полезная информация

next up previous contents index
Next: Ordering Multiple Parts Up: Joining Tables Previous: Self-Joins


Equijoins are the most common type of join. They use equality comparisons (=) to join tables. Figure [*] shows our first non-equijoins.

Figure: Non-equijoins
\par test->~ORDER~BY~p2.cost\end{list}\par

The first query is a non-equijoin because it uses a not-equal (<>) comparison to perform the join. It returns all customers not in the same country as customernumber 648. The second query uses less-than (<) to perform the join. Instead of finding equal values to join, all rows greater-than the column's value are joined. The query returns the all employees hired after employee number 24. The third query uses greater-than (>) in a similar way. The query returns all parts that cost less than part number 153. Non-equijoins are not used very often, but there are certain queries than can only be performed using non-equijoins.

Bruce Momjian