Tuesday, February 26, 2013

Equi-join Versus Non-Equi-join


The join condition determines whether the join is an euai-join or a non-equi join. When a join condition relates  two tables by equating the columns from the tables, it is an equi-join. When a join condition relates two tables by an operator other than equality, it is a non-equi-join.
Equi-joins are the most common join type.

For example,
SELECT S.NAME SUPPLIER_NAME, P.NAME PART_NAME
FROM SUPPLIER S, PART P
WHERE S.SUPPLIER_ID = P.SSPPLIER_ID;

There are some situations in which we need non-equi joins to get required information.
For example,

SELECT P.NAME PART_NAME, C.CLASS INV_Class
FROM PART P, INVENTORY_CLASS C
WHERE P.UNIT_COST BETWEEN C.LOW_COST AND C.HIGH_COST;

No comments:

Post a Comment