Concept:
Relational Algebra consists of basic operators like Selection ($\sigma$), Projection ($\pi$), and Cartesian Product ($\times$). From these basic operators, more complex "derived" operators are created to simplify queries.
Step 1: Understanding Cartesian Product ($R \times S$).
A Cartesian Product takes two relations $R$ and $S$ and returns a new relation containing every possible combination of tuples from $R$ and $S$. If $R$ has $n$ rows and $S$ has $m$ rows, the product has $n \times m$ rows. This is usually very large and contains many nonsensical combinations.
Step 2: Applying Selection ($\sigma_{\theta}$).
To make the Cartesian product useful, we apply a selection condition ($\theta$). This filters the $n \times m$ rows and keeps only those where the condition $\theta$ is true (e.g., $R.ID = S.ID$).
\[ \text{Operation} = \sigma_{\theta}(R \times S) \]
Step 3: Defining the Theta Join.
By definition, a Theta Join ($R \bowtie_{\theta} S$) is specifically defined as a shorthand for $\sigma_{\theta}(R \times S)$.
• Unlike a Natural Join, which automatically joins on columns with the same name and removes duplicate columns, a Theta Join allows any comparison operator ($=, <, >, \neq$) and keeps all columns.