About
The union operation will takes two relations that are union-compatible (ie both relations have the same number of fields with the same types and returns all Tuples appearing in either relation (in Rel 1 or in Rel 2)
An union performed:
Symbol
Set
Set Union (no duplicate allowed - ie distinct) <MATH> \begin{array}{c} \LARGE R_1 \cup R_2 \\ \end{array} </MATH>
Sql equivalence: (union)
Bag
Bag Union (duplicate allowed) <MATH> \begin{array}{c} \LARGE R_1 \uplus R_2 \\ \end{array} </MATH>
Sql equivalence: (union all)
Example
Select the blue and red shirt <MATH> \LARGE \sigma_{(color=Blue)} \text{Shirts} \cup \sigma_{(color=Red)} \text{Shirts} </MATH> where:
- <math>\sigma</math> is a selection operator with color=… being its condition (predicate)
- Shirts is the relation