Set Theoretic Operation

Name Symbol Keyboard Form Example
UNION UNION RS, or R UNION S
INTERSECTION INTERSECT RS, or R INTERSECT S
DIFFERENCE — or MINUS R—S, or R MINUS S
PRODUCT × TIMES R×S, or R TIMES S

Tables R and S are compatible if they have the same headings; that is, if Head(R)=Head(S), with attributes chosen from the same domains and with the meanings.
R
A B C
a1 b1 c1
a1 b2 c3
a2 b1 c2
S
A B C
a1 b1 c1
a1 b1 c2
a1 b2 c3
a3 b2 c3

Let R and S be two compatible tables, where Head(R)=Head(S)=A1…An.
Union
The union of R and S is the table R∪S, with the same heading, consisting of all rows that are in R or in S or in both.

Intersection
The intersection of R and S is the table R∩S, with the same heading, consisting of all rows that are in both R and S.
RS
A B C
a1 b1 c1
a1 b2 c3
a2 b1 c2
a1 b1 c1
a1 b1 c2
a1 b2 c3
a3 b2 c3

RS
A B C
a1 b1 c1
a1 b2 c3
Difference
The difference of R and S is the table R–S, with the same heading, consisting of all rows that are in R but do not appear in S.
S–R
A B C
a1 b1 c2
a3 b2 c3
R–S
A B C
a2 b1 c2



      What’s worse than biting into an apple and discovering a worm?    
      Biting into an apple and discovering half a worm.