# Relational Algebra - Union operator

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) $$\begin{array}{c} \LARGE R_1 \cup R_2 \\ \end{array}$$

Sql equivalence: (union)

### Bag

Bag Union (duplicate allowed) $$\begin{array}{c} \LARGE R_1 \uplus R_2 \\ \end{array}$$

Sql equivalence: (union all)

## Example

Select the blue and red shirt $$\LARGE \sigma_{(color=Blue)} \text{Shirts} \cup \sigma_{(color=Red)} \text{Shirts}$$ where: