Aka 'where not exists'
not_matching(left: Relation, right: Relation) -> Relation
Computes a relation as a subset of
left tuples for which no tuple from
right would join on common attributes.
This operator is the inverse of
matching, as shown by the definition
below. It keeps all tuples from
left but those that match a tuple from
def not_matching(left, right) minus(left, matching(left, right)) end not_matching(suppliers, shipments)
The synonym 'where not exists' comes from the fact that, since right attributes do not appear in the result, it may seem more intuitive to think about this operator as filtering tuples from left where there does not exist any tuple from right that would join. In SQL terms:
SELECT * FROM left WHERE NOT EXISTS (SELECT * FROM right WHERE [join condition])
As for join and matching, you must take care of ensuring that the list of
common attributes on which the (not) matching applies corresponds to what
you want. Renamings and projections are worth having at hand.
Alternatively, shortcuts can be considered (see