Union, Intersection, Difference Operations¶
- The union operator allows us to combine two relations
- The intersection operator allows us to take the intersection of two relations
- The difference operator allows us to take the difference of two relations
- For \(r \cup s\), \(r \cap s\) , or \(r-s\) to be valid,
- r and s must have the same number of attributes
- the attribute domains must be compatible with each other
Example¶
$$\begin {align}
\quad &\Pi_{\,course_ID}\,(\sigma_{semester=^"Fall^" \,\land\,year=2017}\,(section)) \ \ \cup \
\quad &\Pi_{\,course_ID}\,(\sigma_{semester=^"Spring^" \,\land\,year=2018}\,(section)) \
\end {align}$$