So, welcome back. So now,
we're going to talk about the join operator.
And more specifically, the theta-join.
So, join between two different relation in the database, r and s,
is similar to the Cartesian products,
except that, the Cartesian products,
you perform a selection on all the combined tuples of the Cartesian product,
and the selection predicate is theta.
So, that's a selection predicate.
So, what does it mean?
So, Cartesian product just find all combinations of tuples with an r and s,
and combine them together.
Theta-join, it does not just find all combinations.
Yes, if you think of it as if it applies a Cartesian product, find all combinations,
and for all the found combinations that applies a predicate, or a condition,
on these tuples, and filter out the combined tuples that do not satisfy this condition.
So, an example query is if you have two tables,
you have the CSE professors,
these are computer science professors,
and you have another table that has
all the courses that each professor is currently teaching.
And the join operator you want to apply,
you want to find all the courses that each professor is currently teaching,
and you want to find the information of the professor and the information of the course.
So, this is a join between the cse_prof table and the teaches,
the currently teaches table, or relation.
And again, the schema of the output of
the join is also similar to the schema of the output of
the Cartesian product that combines
both the schema of cse_prof and the schema of the teaches.
So, this is teaches,
sorry, instead of cse_teaching,
and this is cse-prof.
If you want to have a join between both of them, again,
like we said in last slide,
cse_profs and then you do the join,
and the theta condition here is,
you want the name in the cse_profs table is equal to the tname in the teaches table.