* add a few set-theoretic operations
to Cartesian Product
* union
* intersection
* difference
* union - A u B -
if something is in A, it is in the union,
and if something is in B, it is in the
union
* intersection - A n B -
if something is a member of A and ALSO
a member of B,
then it is in the intersection of A and B
* difference - A - B -
the elements of A that are not also in B
* so, consider that a relation IS a set
of rows/tuples --
you can DO the above with relations,
WITH some restrictions --
* the two relations HAVE to be
UNION-COMPATIBLE (yes, for intersection and
difference, too)
* the two relations have to have the
same number of attributes
* the attributes, relative between the
two relations, should IDEALLY have
the SAME domain,
(in a DBMS, it can only check of
the attributes have compatible
TYPES...)
* SQL syntax for these operations
(sub-select)
UNION
(sub-select)
[order by ...] <-- ordering the union'd result
(sub-select)
INTERSECT
(sub-select)
[order by ...] <-- ordering the intersect'd result
(sub-select)
MINUS
(sub-select)
[order by ...] <-- ordering the minus'd result