<s>
Set	B-Language
operations	I-Language
allow	O
the	O
results	O
of	O
multiple	O
queries	B-Language
to	O
be	O
combined	O
into	O
a	O
single	O
result	B-Application
set	I-Application
.	O
</s>
<s>
In	O
SQL	B-Language
the	O
UNION	O
clause	O
combines	O
the	O
results	O
of	O
two	O
SQL	B-Language
queries	I-Language
into	O
a	O
single	O
table	B-Application
of	O
all	O
matching	O
rows	B-Application
.	O
</s>
<s>
The	O
two	O
queries	B-Language
must	O
result	O
in	O
the	O
same	O
number	O
of	O
columns	B-Application
and	O
compatible	O
data	O
types	O
in	O
order	O
to	O
unite	O
.	O
</s>
<s>
UNION	O
can	O
be	O
useful	O
in	O
data	O
warehouse	O
applications	O
where	O
tables	O
are	O
not	O
perfectly	O
normalized	B-Application
.	O
</s>
<s>
A	O
UNION	O
query	B-Language
could	O
combine	O
results	O
from	O
both	O
tables	O
.	O
</s>
<s>
Note	O
that	O
UNION	O
ALL	O
does	O
not	O
guarantee	O
the	O
order	O
of	O
rows	B-Application
.	O
</s>
<s>
Rows	B-Application
from	O
the	O
second	O
operand	O
may	O
appear	O
before	O
,	O
after	O
,	O
or	O
mixed	O
with	O
rows	B-Application
from	O
the	O
first	O
operand	O
.	O
</s>
<s>
yields	O
this	O
result	B-Application
set	I-Application
,	O
though	O
the	O
order	O
of	O
the	O
rows	B-Application
can	O
vary	O
because	O
no	O
ORDER	O
BY	O
clause	O
was	O
supplied	O
:	O
</s>
<s>
Note	O
that	O
there	O
are	O
two	O
rows	B-Application
for	O
Joe	O
because	O
those	O
rows	B-Application
are	O
distinct	O
across	O
their	O
columns	B-Application
.	O
</s>
<s>
There	O
is	O
only	O
one	O
row	O
for	O
Alex	O
because	O
those	O
rows	B-Application
are	O
not	O
distinct	O
for	O
both	O
columns	B-Application
.	O
</s>
<s>
The	O
SQL	B-Language
INTERSECT	O
operator	O
takes	O
the	O
results	O
of	O
two	O
queries	B-Language
and	O
returns	O
only	O
rows	B-Application
that	O
appear	O
in	O
both	O
result	B-Application
sets	I-Application
.	O
</s>
<s>
For	O
purposes	O
of	O
duplicate	O
removal	O
the	O
INTERSECT	O
operator	O
does	O
not	O
distinguish	O
between	O
NULLs	B-Language
.	O
</s>
<s>
The	O
INTERSECT	O
operator	O
removes	O
duplicate	O
rows	B-Application
from	O
the	O
final	O
result	B-Application
set	I-Application
.	O
</s>
<s>
The	O
INTERSECT	O
ALL	O
operator	O
does	O
not	O
remove	O
duplicate	O
rows	B-Application
from	O
the	O
final	O
result	B-Application
set	I-Application
,	O
but	O
if	O
a	O
row	O
appears	O
X	O
times	O
in	O
the	O
first	O
query	B-Language
and	O
Y	O
times	O
in	O
the	O
second	O
,	O
it	O
will	O
appear	O
times	O
in	O
the	O
result	B-Application
set	I-Application
.	O
</s>
<s>
The	O
following	O
example	O
INTERSECT	O
query	B-Language
returns	O
all	O
rows	B-Application
from	O
the	O
Orders	O
table	B-Application
where	O
Quantity	O
is	O
between	O
50	O
and	O
100	O
.	O
</s>
<s>
The	O
SQL	B-Language
EXCEPT	O
operator	O
takes	O
the	O
distinct	O
rows	B-Application
of	O
one	O
query	B-Language
and	O
returns	O
the	O
rows	B-Application
that	O
do	O
not	O
appear	O
in	O
a	O
second	O
result	B-Application
set	I-Application
.	O
</s>
<s>
For	O
purposes	O
of	O
row	O
elimination	O
and	O
duplicate	O
removal	O
,	O
the	O
EXCEPT	O
operator	O
does	O
not	O
distinguish	O
between	O
NULLs	B-Language
.	O
</s>
<s>
The	O
EXCEPT	O
ALL	O
operator	O
does	O
not	O
remove	O
duplicates	O
,	O
but	O
if	O
a	O
row	O
appears	O
X	O
times	O
in	O
the	O
first	O
query	B-Language
and	O
Y	O
times	O
in	O
the	O
second	O
,	O
it	O
will	O
appear	O
times	O
in	O
the	O
result	B-Application
set	I-Application
.	O
</s>
<s>
Notably	O
,	O
the	O
Oracle	O
platform	O
provides	O
a	O
MINUS	O
operator	O
which	O
is	O
functionally	O
equivalent	O
to	O
the	O
SQL	B-Language
standard	I-Language
EXCEPT	O
DISTINCT	O
operator	O
.	O
</s>
<s>
The	O
following	O
example	O
EXCEPT	O
query	B-Language
returns	O
all	O
rows	B-Application
from	O
the	O
Orders	O
table	B-Application
where	O
Quantity	O
is	O
between	O
1	O
and	O
49	O
,	O
and	O
those	O
with	O
a	O
Quantity	O
between	O
76	O
and	O
100	O
.	O
</s>
<s>
Worded	O
another	O
way	O
;	O
the	O
query	B-Language
returns	O
all	O
rows	B-Application
where	O
the	O
Quantity	O
is	O
between	O
1	O
and	O
100	O
,	O
apart	O
from	O
rows	B-Application
where	O
the	O
quantity	O
is	O
between	O
50	O
and	O
75	O
.	O
</s>
